// self.vIEw.backgroundcolor = UIcolor.greencolor();
var backItem:UIbarbuttonItem = UIbarbuttonItem(Title: "返回",style: UIbarbuttonItemStyle.Plain,target: self,action: Selector("backbuttontouched"))
self.navigationItem.leftbarbuttonItem = backItem
var label: UILabel = UILabel()
let coo=UIcolor(red: 0.2,green: 0.1,blue: 1,Alpha: 1);
label.backgroundcolor=coo;
label.frame = CGRect(x:50,y:100,wIDth:200,height:100)
label.text = "第一次进入swift的世界"
self.vIEw.addSubvIEw(label)
var button = UIbutton.buttonWithType(UIbuttonType.System) as? UIbutton
button!.frame = CGRectMake(110.0,120.0,100.0,50.0)
button!.backgroundcolor = UIcolor.graycolor()
button?.setTitlecolor(UIcolor.redcolor(),forState: UIControlState.normal)
button!.setTitlecolor(UIcolor.whitecolor(),forState: UIControlState.Highlighted)
button?.setTitle("touch Me",forState: UIControlState.normal)
button?.setTitle("touch",forState: UIControlState.Highlighted)
button?.addTarget(self,action: "buttonAction:",forControlEvents: UIControlEvents.touchUpInsIDe)
button!.tag = 100
self.vIEw.addSubvIEw(button!)
func backbuttontouched()
{
println("点击了返回键")
}
func buttonAction(sender: UIbutton)
{
NSLog("asdfasd")
// var bbb=maem()
// self.navigationController?.pushVIEwController(bbb,animated: true)
// print(sender);
}
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.vIEwContr = [[VIEwController alloc] init];
self.vIEwContr.vIEw.backgroundcolor = [UIcolor whitecolor];
UINavigationController *nav = [[UINavigationController alloc] initWithRootVIEwController:self.vIEwContr];
nav.navigationbarHIDden = YES;
self.window.rootVIEwController = nav;
[self.window makeKeyAndVisible];
总结以上是内存溢出为你收集整理的swift全部内容,希望文章能够帮你解决swift所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)