码迷,mamicode.com
首页 > 其他好文 > 详细

viewController

时间:2015-02-26 20:08:48      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:

Xcode6,

引入viewController代码:

 

1.在Appdelegate先引入ViewController头文件

2.ViewController vc =(ViewController alloc)init;

 Self.window.rootViewController = vc; 

然后vc就代表ViewController对象,就可以调用其属性和方法了。

 般用通知来取代上面的写法:

//

发送通知 

[[[[NSNotificationCenterdefaultCenter]] postNotificationName:

通知名object::nil]; 

//接受通知

//IB

创建的对象调用initWithCoder

要复写方法;

-(instancetype) initWithCoder(NSCoder*)coder{ 

self = [super initWithCoder:coder]; 

if(self){ 

[[ 

NSNotificationCenter 

defaultCenter]addObserver:self 

selector:@selector(method)name:@

”…

.

object:nil ]; 

return self; 

UILabel 

多行文字自动换行(自动折行)

 UIView *footerView = [[UIView alloc] initWithFrame:CGRectMake(10, 100, 300, 

180)]; 

UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 100, 300, 150)]; 

label.text = @"where are you? where are you? where are you? where are you? 

where are you? where are you? where are you? where are you? where are you? 

where are you?"; 

//

清空背景颜色

label.backgroundColor = [UIColor clearColor]; 

viewController

标签:

原文地址:http://www.cnblogs.com/haolianxue/p/4301976.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!