1. 输入法切换: cmd + space
2. xcode 退出全屏control + cmd + f
3. xcode 代码格式化插件Uncrustify,XAlign, CLangFormat
4.ios程序启动的过程如下:
1. 程序入口main函数创建UIApplication实例和UIApplication代理实例。
2. 在UIApplication代理实例中重写启动方法,设置第一ViewController。
3. 在第一ViewController中添加控件,实现应用程序界面。
5. ios默认的图片格式为png,如果需要显示jpg格式,需要输入将图片的后缀.jpg
6. 更改字体大小
cityBtn.font = [UIFont systemFontOfSize:15];
7. NSString相关方法
,字符串拼接
NSString *newString = [NSString stringWithFormat:@"%@%@",tempA,tempB];
- (NSString *)stringByAppendingString:(NSString *)aString;
,字符转int
intString = [newString intValue];
,int转字符
NSString *stringInt = [NSString stringWithFormat:@"%d",intString]; ,字符转float
float floatString = [newString floatValue] , 替换
NSString *strUrl = [urlString stringByReplacingOccurrencesOfString:@" " withString:@""]; 6, 截取
- (NSString *)substringFromIndex:(NSUInteger)from;
- (NSString *)substringToIndex:(NSUInteger)to;
- (NSString *)substringWithRange:(NSRange)range;
7. 页面的跳转和退出
self presentViewController:[MainViewController new]animated:YES completion:^{}];
[self dismissViewControllerAnimated:YES completion:^{}];
8. 初始化navigationBar
// titleBar
UINavigationBar *titleBar = [[UINavigationBar alloc]
initWithFrame:CGRectMake(, , screen_width, Title_Height)];
[titleBar setBarTintColor:Main_Color];
[titleBar
setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor],
NSForegroundColorAttributeName,
nil]];
UINavigationItem *titleItem =
[[UINavigationItem alloc] initWithTitle:@"首页"];
[titleBar pushNavigationItem:titleItem animated:NO];
[self.view addSubview:titleBar];
9. 取消tabView cell的选中状态,写在cell item点击事件当中
[tableView deselectRowAtIndexPath:indexPath animated:YES];
10. 禁用Table View 的点击事件 写在自定义的Table View cell 中
self.selectionStyle = UITableViewCellSelectionStyleNone;
11. UILabel自动换行
lbDataItem.lineBreakMode = NSLineBreakByWordWrapping;
lbDataItem.numberOfLines = 0;
12. TabBar的数字徽章
vc1.tabBarItem.badgeValue = @"123";
13. 隐藏navigationBar
self.navigationController.navigationBarHidden = YES;
14 .隐藏navigationLeftItem
self.navigationItem.hidesBackButton = YES;
15. 更改navigationBar的背景颜色, 需要在appDelegate中配置
[UINavigationBar appearance].barTintColor = [UIColor yellowColor];
16. iOS模拟器不出现键盘
1、选中模拟器,在屏幕上方的菜单中找到Hardware->Keyboard
2、直接快捷键shift+command+k