开发者

Loading Different Views With Segmented Control

开发者 https://www.devze.com 2022-12-27 15:43 出处:网络
I am using a segmented control with 2 segments on one of the tab bar items on my iPhone app. Essentially, I would like to display two different views when each segment is selected - one segment shows

I am using a segmented control with 2 segments on one of the tab bar items on my iPhone app. Essentially, I would like to display two different views when each segment is selected - one segment shows a tableview and the other segment shows a mapview.

So, when segment 1 is tapped, a tableview is displayed. And on tap of segment 2, a mapview is displayed. Each view has its own controller and is loaded from its own nib file. Is this possible?

I success开发者_StackOverflowfully created the two views (and controllers) and the two segment controls (on the navigation bar) via XCode but have no idea how to proceed next. Any suggestions and sample code to would be most appreciated.


The View Controller Programming Guide contains sample code and will help you in understanding how to achieve your task.

As far as i understand your situation, i think you should be able to connect the tab bar items to the view controllers with the Interface Builder by configuring the Tab Bar Items with the Inspector.

0

精彩评论

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

关注公众号