Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- NSString *myfile = [[NSBundle mainBundle] pathForResource:@"list" ofType:@"plist"];
- courses = [[NSDictionary alloc] initWithContentsOfFile:myfile];
- NSArray *sortList = [courses allKeys];
- courseKeys = [sortList sortedArrayUsingSelector:@selector(compare:)];
- }
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- {
- return 1;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- return [courses count];
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- static NSString *CellIdentifier = @"Cell";
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
- if (cell == nil) {
- cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
- }
- // Configure the cell...
- NSString *currentCourseName = [courseKeys objectAtIndex:[indexPath row]];
- [[cell textLabel] setText:currentCourseName];
- NSString *subtitle = [courses objectForKey:[courseKeys objectAtIndex:indexPath.row]];
- [[cell detailTextLabel] setText:subtitle];
- return cell;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement