开发者

How can I implement an image detail view for my table view?

I have a table view that for each entry I want to display a separate image in a detail view. I have my table view data stored in an NSArray, which I then copy over to an NSDictionary to make my entries searchable. I have found tutorials for how to make an image detail view, but I do not know how to still keep my table searchable. I am still very new to 开发者_JAVA百科iOS development, so please be detailed.


Just don't release NSDictionary or any of your data sources.

In the didSelectRowAtIndexPath: method you lazily instantiate your UIViewController containing your UIImageView (or whatever else it is you want to display) and set your subview's image property with the desired image. By doing this you're just keeping one subview around and just change the image in this subview.

I hope I answered your question :) (I'm not 100% sure though)

EDIT: Added some code for illustration purposes

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{if(!subview){UIViewController *subview=[[UIViewController alloc]init];
subview.delegate=self;}
subview.image=[UIImage ...];
...
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜