简体   繁体   English

将我在Map上的对象与数据连接

[英]connecting my objects on Map with data

I have application that shows objects on map for iPhone and iPad. 我有在iPhone和iPad的地图上显示对象的应用程序。

My problem is how to connect those objects with description from sqlite database in order to go from Map when I click on info for pin to page with description and everything else. 我的问题是如何在sqlite数据库中连接那些具有描述的对象,以便在单击信息以与描述及其他所有信息固定到页面时从Map转到地图。

i manage to add button: 我设法添加按钮:

UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
    [rightButton setTitle:annotation.title forState:UIControlStateNormal];
    [rightButton addTarget:self
                    action:@selector(showDetails:)
          forControlEvents:UIControlEventTouchUpInside];
    annView.rightCalloutAccessoryView = rightButton;

I also added in viewDid load alloc and init for that view controller: 我还为该视图控制器添加了viewDid的load alloc和init:

  self.details = [[[RestaurantDetails alloc]init]autorelease];

But now when I press button on annotation it only shows me blank screen. 但是现在当我按注释上的按钮时,它只显示空白屏幕。

Can someone tell me how to pull data from sqlite database to show it on screen. 谁能告诉我如何从sqlite数据库中提取数据以在屏幕上显示。 I need logic of that process. 我需要该过程的逻辑。 :) :)

Thanks. 谢谢。

you have to create custom annotation view and before that you have to read data from database. 您必须创建自定义注释视图,然后才能从数据库读取数据。 and in custom annotation view, you can show that data. 在自定义注释视图中,您可以显示该数据。
Just google for custom annotation view and you will get it done. 只是谷歌自定义注释视图,您将完成它。
For Sqlite database you can refer this. 对于Sqlite数据库,您可以参考此内容。

I understand the logic of that and I call simple view controller that dont connect database and it work fine. 我理解这的逻辑,我称之为不连接数据库的简单视图控制器,它工作正常。 But the problem initiate when have to work with database. 但是问题是在必须使用数据库时启动的。 Will try to figure out that tutorial seems nice. 将尝试找出该教程似乎不错。 Thank you for the link... 谢谢你的链接...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM