主要活动我正在命名我的项目"MyFirstApp"
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace MyFirstApp
{
[Activity (Label = "MyFirstApp", MainLauncher = true)]
public class MainActivity : Activity
{
int count = 1;
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button> (Resource.Id.myButton);
button.Click += delegate { …Run Code Online (Sandbox Code Playgroud) 我有这个代码UIButton.我应该在我的改变CGRectMake设置我UIButton的屏幕中心为所有屏幕尺寸?
let loginBtn = UIButton(frame: CGRectMake(60, 360, 240, 40))
loginBtn.layer.borderColor = UIColor.whiteColor().CGColor
loginBtn.layer.borderWidth = 2
loginBtn.titleLabel!.font = UIFont.systemFontOfSize(24)
loginBtn.tintColor = UIColor.whiteColor()
loginBtn.setTitle("Login", forState: UIControlState.Normal)
self.view.addSubview(loginBtn)
Run Code Online (Sandbox Code Playgroud) 我正在学习 Java 脚本,有一个关于获取用户输入的数字的阶乘的练习,但由于某种原因我总是得到答案是 = 1
这是我的代码:
<SCRIPT>
function factorial(num){
for (n=1; n<=num; n++){
return fact*n;
}
}
var myNum, fact;
myNum = parseFloat(window.prompt('Enter positive integer : ',''));
fact = 1;
document.write('the factorial of the number is = '+ factorial(myNum));
</SCRIPT>
Run Code Online (Sandbox Code Playgroud)