1.whose view is not in the window hierarchy
Where are you calling this method from? I had an issue where I was attempting to present a modal view controller within the viewDidLoad
method. The solution for me was to move this call to the viewDidAppear:
method.
My presumption is that the view controller's view is not in the window hierarchy at the point that it has been loaded (when the viewDidLoad
message is sent), but it is in the window hierarchy after it has been presented (when the viewDidAppear:
message is sent).
2.TableView
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView //表示一共有多少段,所谓段就好比通讯录中A-Z这么来区分用户组,这个段就是一个字母. 你希望你的TABLE有多少个HEADER就有多少个 section
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
//每个section有多少行,比如你通讯录中以A开头的联系人有2个,就是2
- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
//每一段的头部的样式,自己定义,加个图片,价格LABEL都行
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
//每一段头部的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
//每一段中的每一行的高度
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
//每一段中的每一行的样式,可以自己定义// indexPath.section 来确定是哪个段, indexPath.row来确定哪个行
3.Receiver 'NSManagedObjectContext' for class message is a forward declaration
来自stackoverflow的解答:
You must import CoreData/CoreData.h in the file Supporting Files/YourApp-Prefix.pch:
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#endif