小编nev*_*asy的帖子

在Storyboard中切换UINavigationController堆栈的最佳实践

在我们的故事板中,我们有多个UINavigationController堆栈.例如,LoginViewController堆栈与堆栈完全分离SWRevealViewController.

切换它们的最佳做法是什么?当我按下注销按钮(注销按钮在SWRevealController堆栈上)然后尝试呈现LoginViewController堆栈时,我收到如下错误:

Warning: Attempt to present LoginViewController on SWRevealViewController whose view is not in the window hierarchy!
Run Code Online (Sandbox Code Playgroud)

即使我专门设置self.window.rootViewControllerUINavigationControllerApp Delegate中的Login View Controller ,如下所示:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Spitfire" bundle:nil];
UINavigationController *nav = [storyboard instantiateViewControllerWithIdentifier:@"LoginNavigationController"];
LoginViewController *loginVC = [storyboard instantiateViewControllerWithIdentifier:@"LoginViewController"];

self.window.rootViewController = nav;
[nav presentViewController:loginVC animated:NO completion:nil];    
Run Code Online (Sandbox Code Playgroud)

有没有办法可以"解雇"当前的UINavigationController堆栈并使用新堆栈?或者也许我不应该在我的应用代理中调用此代码?

storyboard uinavigationcontroller ios

5
推荐指数
1
解决办法
3694
查看次数

UITableView segue无法正常工作

我在文档中关注了SimpleDrillDown应用程序示例,该应用程序在第一个UITableView中显示锻炼名称,在第二个UITableView中显示锻炼.

我的应用程序在Dropbox这里:http://db.tt/V0EhVcAG

我使用了故事板,有原型单元格,但是当我在模拟器中加载时,第一个UITableView不会让我点击并转到细节UITableView.披露指标V形不加载.该应用程序构建成功,没有正式错误.

我的表视图位于导航控制器中,我的segue和prototype单元都在故事板中相应命名.

SpitfireViewController.m

- (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 …
Run Code Online (Sandbox Code Playgroud)

uitableview ios segue

2
推荐指数
1
解决办法
5959
查看次数

arrayWithContentsOfFile和arrayWithContentsOfURL为零

当我调用[NSArray arrayWithContentsOfFile:]时,我得到零.

NSURL *fileURL = [NSURL URLWithString:className relativeToURL:[self JSONDataRecordsDirectory]];
return [NSArray arrayWithContentsOfFile:[NSString stringWithFormat:@"%@", [fileURL path]]];
Run Code Online (Sandbox Code Playgroud)

或者,我打电话时也会收到:

[NSArray arrayWithContentsOfURL:]
Run Code Online (Sandbox Code Playgroud)

我的所有文件的结果都在JSON中:https: //gist.github.com/neverbendeasy/03d047a6789b0ae14e1f

当我检查fileURL时,数据就在那里.

我错过了什么?

json objective-c plist ios

0
推荐指数
1
解决办法
957
查看次数