nev*_*asy 2 uitableview ios segue
我在文档中关注了SimpleDrillDown应用程序示例,该应用程序在第一个UITableView中显示锻炼名称,在第二个UITableView中显示锻炼.
我的应用程序在Dropbox这里:http://db.tt/V0EhVcAG
我使用了故事板,有原型单元格,但是当我在模拟器中加载时,第一个UITableView不会让我点击并转到细节UITableView.披露指标V形不加载.该应用程序构建成功,没有正式错误.
我的表视图位于导航控制器中,我的segue和prototype单元都在故事板中相应命名.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [dataController countOfList];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"WorkoutCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
Workout *workoutAtIndex = [dataController objectInListAtIndex:indexPath.row];
cell.textLabel.text = workoutAtIndex.title;
return cell;
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"showExercises"]) {
NSIndexPath *selectedRowIndex = [self.tableView indexPathForSelectedRow];
DetailViewController *detailViewController = [segue destinationViewController];
detailViewController.workout = [dataController objectInListAtIndex:selectedRowIndex.row];
}
}
Run Code Online (Sandbox Code Playgroud)
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [workout.exercises count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"ExerciseCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = [workout.exercises objectAtIndex:indexPath.row];
return cell;
}
Run Code Online (Sandbox Code Playgroud)
#import <UIKit/UIKit.h>
@class DataController;
@class SpitfireViewController;
@interface SpitfireAppDelegate : UIResponder <UIApplicationDelegate>
{
UIWindow *window;
SpitfireViewController *spitfireViewController;
DataController *dataController;
}
@property (strong, nonatomic) UIWindow *window;
@end
Run Code Online (Sandbox Code Playgroud)
#import "SpitfireAppDelegate.h"
#import "SpitfireViewController.h"
#import "DataController.h"
@implementation SpitfireAppDelegate
@synthesize window;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
spitfireViewController = [[SpitfireViewController alloc] init];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:spitfireViewController];
DataController *controller = [[DataController alloc] init];
spitfireViewController.dataController = controller;
[window addSubview:[navController view]];
[self.window makeKeyAndVisible];
return YES;
}
@end
Run Code Online (Sandbox Code Playgroud)

小智 5
如果你有tableview cell segue selection问题.
UITableViewDelegate和UITableViewDataSource使用"静态单元格"
| 归档时间: |
|
| 查看次数: |
5959 次 |
| 最近记录: |