- (void)viewDidLoad {
//得到untitled。plise 这个文件的位置
NSString *path = [[NSBundle mainBundle] pathForResource:@"untitled"
ofType:@"plist"];
// 将这个文件载入
NSDictionary *dict =[[NSDictionary alloc] initWithContentsOfFile:path];
self.movieTitle = dict;
[dict release];
//将里面的内容进行排序
NSArray *array = [[movieTitle allKeys] sortedArrayUsingSelector:@selector(compare:)];
self.classes = array;
[super viewDidLoad];
self.clearsSelectionOnViewWillAppear = NO;
self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0);
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)aTableView {
// 分成classes个部分
return [classes count];
}- (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section {
// tableview 的行数 返回多少行
NSString *test = [classes objectAtIndex:section];
NSArray *movieSection = [movieTitle objectForKey:test];
return [movieSection count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"CellIdentifier";
// Dequeue or create a cell of the appropriate type.
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryNone;
}
NSString *test = [classes objectAtIndex:[indexPath section]];
NSArray *movieSection =[movieTitle objectForKey:test];
// Configure the cell.
cell.textLabel.text = [movieSection objectAtIndex:[indexPath row]];
return cell;
}
-(NSString *)tableView: (UITableView *) tableView
titleForHearderInSection:(NSInteger) section{
NSString *test = [classes objectAtIndex:section];
return test;
}
//得到untitled。plise 这个文件的位置
NSString *path = [[NSBundle mainBundle] pathForResource:@"untitled"
ofType:@"plist"];
// 将这个文件载入
NSDictionary *dict =[[NSDictionary alloc] initWithContentsOfFile:path];
self.movieTitle = dict;
[dict release];
//将里面的内容进行排序
NSArray *array = [[movieTitle allKeys] sortedArrayUsingSelector:@selector(compare:)];
self.classes = array;
[super viewDidLoad];
self.clearsSelectionOnViewWillAppear = NO;
self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0);
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)aTableView {
// 分成classes个部分
return [classes count];
}- (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section {
// tableview 的行数 返回多少行
NSString *test = [classes objectAtIndex:section];
NSArray *movieSection = [movieTitle objectForKey:test];
return [movieSection count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"CellIdentifier";
// Dequeue or create a cell of the appropriate type.
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryNone;
}
NSString *test = [classes objectAtIndex:[indexPath section]];
NSArray *movieSection =[movieTitle objectForKey:test];
// Configure the cell.
cell.textLabel.text = [movieSection objectAtIndex:[indexPath row]];
return cell;
}
-(NSString *)tableView: (UITableView *) tableView
titleForHearderInSection:(NSInteger) section{
NSString *test = [classes objectAtIndex:section];
return test;
}
解决方案 »
- 菜鸟求一个 把照片传到服务器的代码!
- 请教一个问题?
- boost的asio socket api接口支持iOS吗
- 请教如何将unsigned short数组转换成NSString??
- Xcode4.6中怎么嵌入kal日历?各位高手指点指点啊
- iOS新手请教 View之间传值
- [福利]swift中文版手册(完整版)
- 请问下面的 peerPickerController:(GKPeerPickerController *)picker的含义
- 怎么编译不了啊
- iOS product name,bundle display name,iTunes connect 中应用名称怎样填写能通过审核
- 如何初始化类成员变量?
- iphone怎么接收.net webservice返回的dataset
这么打印一下看看classes是不是有问题
还有就是你的classes在@property中加入了retain属性了吗
@property中是这样的@property (nonatomic, retain) NSArray *classes; 应该没问题吧
问下 NSLog("%@", classes); 应该放哪 什么情况是有问题的呢
(问的是不是有点2 嘿嘿O(∩_∩)O~)
//得到untitled。plise 这个文件的位置
NSString *path = [[NSBundle mainBundle] pathForResource:@"untitled"
ofType:@"plist"];
// 将这个文件载入
NSDictionary *dict =[[NSDictionary alloc] initWithContentsOfFile:path];
self.movieTitle = dict;
[dict release];
//将里面的内容进行排序
NSArray *array = [[movieTitle allKeys] sortedArrayUsingSelector:@selector(compare:)];
self.classes = array;
这里放一次,
- (NSInteger)numberOfSectionsInTableView:(UITableView *)aTableView {
// 分成classes个部分
这里放一次,
然后点开gdb,看看控制台里面打印出classes的数据时不是你想要的
查了两天了 写的应该没错 现在就怕是少了什么