广播
//发送者
//发送值改变的广播(通知)
[[NSNotificationCenter defaultCenter] postNotificationName:@"dataChange" object:nil];
//接受者
//接收广播
[[NSNotificationCenter defaultCenter] addObserver:self selector:***@selector(reloadView) name:@"dataChange" object:nil];
- (void)dealloc{
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"dataChange" object:nil];
[super dealloc];
}
push-pop View
[ pushViewController:sub animated:YES];
[ popViewControllerAnimated:YES];
//显示导航条
[ setNavigationBarHidden:NO animated:YES];
模态化弹出
[ presentModalViewController: Controller animated:YES];
[Controller dismissViewControllerAnimated:pletion:^{
}];
动画
[UIView animateWithDuration: animations:^{
//通过transform让imageView转动一周
= ransformRotate(, );
}];
heightForRowAtIndexPath
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
//根据数据源中的数据,以及cell中各个控件的frame的设定,重新计算行高
ChatModle *modle=[_dataArray objectAtIndex:];
CGSize size=[ sizeWithFont:[UIFont systemFontOfSize:18]constrainedToSize:CGSizeMake(260, 999) lineBreakMode:NSLineBreakByCharWrapping];
return +40;
}
UILabel 字体
加粗;
[UILabel setFont:[UIFont fontWithName:@"Helvetica-Bold" size:20]];
加粗并且倾斜
[UILabel setFont:[UIFont fontWithName:@"Helvetica-BoldOblique" size:20]];
UILabel使用自定义字体
博客分类: Phone / IOS / Objective-C
xcode 4
下载自定义字体(例如:)后,拖入项目当中。
在 Supporting Files 中找到(项目名称)-, 添加 Fonts provided by application 项, 打开对应的数组,可以设置多个字体,。
在程序中通过字体family name,找出字体名字。然后使用
C代码
= [UIFont fontwithname:@"Blazed" size:42];
或者
C代码
UIFont *tfont = [UIFont fontWithName:@"Blazed" size:42];
= tfont;
例外还有其他设置:
C代码
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(, , 2
IOS iPhone开发 UI整理总结 来自淘豆网m.daumloan.com转载请标明出处.