某个控件出不来:
1.frame的尺寸和位置对不对
2.hidden是否为YES
3.有没有添加到父控件中
4.alpha 是否 < 0.01
5.被其他控件挡住了
6.父控件的前面5个情况
*/
/**
* 在这个初始化方法中,HeaderView的frame\bounds没有值
*/
- (id)initWithReuseIdentifier:(NSString *)reuseIdentifier
/**
* 当一个控件的frame发生改变的时候就会调用
*
* 一般在这里布局内部的子控件(设置子控件的frame)
*/
- (void)layoutSubviews 一定要调用super的方法
/**
* 当一个控件被添加到父控件中就会调用
*/
- (void)didMoveToSuperview
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{
// 1.创建flagView
FlagView *flagView = [FlagView flagViewWithResuingView:view];
// 2.传递模型
flagView.flag = self.flags[row];
return flagView;
}
+ (instancetype)flagViewWithResuingView:(UIView *)resuingView
{
if (resuingView == nil) {
return [[[NSBundle mainBundle] loadNibNamed:@"FlagView" owner:nil options:nil] lastObject];
} else {
return (FlagView *)resuingView;
}
}
UIBarButtonItem 就是toolBar里的item,toolBar有个items属性,item的空隙用FlexibleSpace
用自己的log替换NSLog #define xxx(...) NSLog(__VA_ARGS__)
#ifdef DEBUG
#define xxx(...) NSLog(__VA_ARGS__)
#else
#define xxx(,,,)
#endif
在info.plist中将view controller - based status。。。。设置成no的意思是将状态栏交给UIApplication管理,统一管理
AppDelegate是应用程序的代理,加载程序,前台后台,中断之类的
return UIApplicationMain(argc, argv, NSStringFromClass([UIApplication class]), NSStringFromClass([AppDelegate class]));
根据第三个参数创建UIApplication对象,第四个创建AppDelegate对象
创建一个控制器:
控制器常见的创建方式有以下几种
通过storyboard创建
直接创建
MJViewController *mj = [[MJViewController alloc] init];
指定xib文件来创建
MJViewController *mj = [[MJViewController alloc] initWithNibName:@"MJViewController" bundle:nil];
改完文件名称,一定要clear和卸载软件。
控制器view延迟加载
tableView的commitEditingStyle可以实现左拖删除的方法
删除cell:1、删除模型数据 2、刷新表格 deleteRowsAtIndexPaths:@[indexPaht] 3、数据归档