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];