Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
329 views
in Technique[技术] by (71.8m points)

iphone - UITabBarController is possible to select the tab via code?

is it UITabBarController possible to select the tab in code?like UINavigationController we can use popViewController pop back to rootViewController instead of press the back button, so how can this implement in tabbarcontroller?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Use the selectedIndex property on the UITabBarController. More information can be found in the UITabBarController Class Reference.

controller.selectedIndex = 4;

or use

[controller setSelectedIndex:4];


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...