首页 > 其他 > 详细

viewController

时间:2015-02-26 20:08:33      阅读:277      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!