1.
self.view.autoresizingMask = UIViewAutoresizingNone; //不自动适应
self.view.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;//左边边距自动适应
self.view.autoresizingMask = UIViewAutoresizingFlexibleRightMargin;//右边距自动适应
self.view.autoresizingMask = UIViewAutoresizingFlexibleTopMargin;
self.view.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin;
self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth;//view的宽自动适应
self.view.autoresizingMask = UIViewAutoresizingFlexibleHeight;
2.
让cell不显示选中的效果的方法是
cell.selectionStyle = UITableViewCellSelectionStyleNone;这样用户点击cell不会显示选中的灰色等状态
cell.selectionStyle = UITableViewCellSelectionStyleGray;
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
cell.userInteractionEnable = NO;//是指用户不能对cell进行操作了,这种方法一般不用
3.@synthesize recipe = _recipe;
这里recipe和_recipe的区别?
_recipe是成员变量,只能在类内使用,只能执行赋值操作,recipe可以用self加点运算符生成get/set方法,在get/set方法中对成员进行更多的操作
4.关于继承的理解
1.父类中的公有属性和方法子类可以直接访问
2.如果子类没有定义与父类的同名方法,子类的对象调用该方法将调用父类中的方法
3.如果子类中定义了与父类中同名但参数不同的方法,那就是重载,当用子类的引用调用该方法时,将根据参数来决定是调用在父类中定义的方法,还是调用在子类中定义的方法.
4.如果子类中定义了与父类中同名且参数个数和类型都相同的方法,那就是重写,当用子类的引用来调用该方法时,只能是调用在子类中定义的方法,父类中的方法被覆盖了
5.UIToolBar和UITabBar的区别
UIToolBar用来展示多个button,这些button作为toolBarItem,可以多个选中
UITabBar上面也有多个button,但是这些button只能选中其中之一,UITabBar最常用来通过点击按钮切换界面
6.
return [super tableView:tableView cellForRowAtIndexPath:indexPath];
返回的是父类调用cellForRowAtIndexPath之后的返回值
7.
UISearchBar的使用
1.创建:self.titleSearchBar = [[UISearchBar alloc] initWithFrame:];
2.self.titleSearchBar.delegate = self;
3.titleSearchBar.placeholder = @”请搜索食材”;
4.实现UISearchBar的delegate方法
searchBarSearchButtonClicked等
8.
使用NSLog(@”%@”,anobject);的方法打印一个对象的属性。
例如NSLog(@”%@”,self.tableView);将打印出tableView的内存地址,frame,contentOffset,Delegate,DataSource等属性