iOS 语录

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相关方法

  

1,字符串拼接
NSString *newString = [NSString stringWithFormat:@"%@%@",tempA,tempB];
- (NSString *)stringByAppendingString:(NSString *)aString;
2,字符转int intString = [newString intValue];
3,int转字符 NSString *stringInt = [NSString stringWithFormat:@"%d",intString]; 4,字符转float float floatString = [newString floatValue] 5, 替换 NSString *strUrl = [urlString stringByReplacingOccurrencesOfString:@" " withString:@""];

6, 截取

- (NSString *)substringFromIndex:(NSUInteger)from;

- (NSString *)substringToIndex:(NSUInteger)to;

- (NSString *)substringWithRange:(NSRange)range;

7. 页面的跳转和退出

1 self presentViewController:[MainViewController new]animated:YES completion:^{}];
2 [self dismissViewControllerAnimated:YES completion:^{}];

8. 初始化navigationBar

 1   // titleBar
 2   UINavigationBar *titleBar = [[UINavigationBar alloc]
 3       initWithFrame:CGRectMake(0, 0, screen_width, Title_Height)];
 4   [titleBar setBarTintColor:Main_Color];
 5   [titleBar
 6       setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
 7                                                [UIColor whiteColor],
 8                                                NSForegroundColorAttributeName,
 9                                                nil]];
10   UINavigationItem *titleItem =
11       [[UINavigationItem alloc] initWithTitle:@"首页"];
12   [titleBar pushNavigationItem:titleItem animated:NO];
13   [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

 

 


                

posted @ 2015-07-15 16:17  鲸歌  阅读(231)  评论(0编辑  收藏  举报