【问题标题】:loading data after loading view in iphone application在 iphone 应用程序中加载视图后加载数据
【发布时间】:2013-05-13 21:07:40
【问题描述】:

您好,我是目标 c 的新手。我正在尝试创建一个登录系统应用程序。

这是我的故事板的样子:

我将使用 AFNetworking 类和 rest php 库来处理数据。

现在您可以看到,我使用推送、模式和导航为我的第一个应用程序创建了导航。

我被困在哪里

当用户点击应用程序中的登录按钮时,应用程序首先将授权用户,然后将带用户查找地点视图。

我需要的是,当我点击登录按钮时,首先将打开地点查找器视图,然后调用函数,该函数将使用 rest api eith json 格式显示地点数据。

 - (IBAction)signin:(id)sender {
  [self performSegueWithIdentifier:@"landingView" sender:sender];
  }


- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

   if ([[segue identifier] isEqualToString:@"landingView"]) {
   // what i do here to call function -"display_place" of class -"showplaces"????

   }
 }

我希望我能知道我是否正确或下一步应该做什么?

谢谢

【问题讨论】:

    标签: iphone objective-c ios4


    【解决方案1】:

    您可以使用 segue 中的 destinationViewController 属性:

     - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    
       if ([[segue identifier] isEqualToString:@"landingView"]) {
          [((showplaces *)segue.destinationViewController) display_places];
       }
     }
    

    顺便说一句,你没有使用正确的类和函数命名...你应该看看其他示例和教程,看看 Objective C 的代码风格如何。

    【讨论】:

    • 嘿@k20,非常感谢您的回答。
    • 这是我按照你说的做后得到的。 “showplaces”没有可见的@interface 声明选择器“display_place”
    • 要访问一个类函数,它需要在你的类的顶部导入(#import "showplaces.h")。另外,请确保在您的 showplaces.h 中声明了“display_place”
    • @Adhaata 我没有看到您的编辑。但是,如果这个问题得到了回答并且您还有其他问题,您应该关闭这个并打开一个新的:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-08
    • 2019-04-10
    相关资源
    最近更新 更多