【发布时间】:2014-10-27 13:34:53
【问题描述】:
首先,我使用的是 Xcode 6 和 Objective-c。我想用按钮或用代码自动更改标签栏屏幕我该怎么做。另一个问题可能是我做这个不同的视图而不是标签栏控制器的项目。
- (IBAction)backButton:(id)sender
{
ProfileSide *vc = (ProfileSide *)[[self.tabBarController viewControllers]objectAtIndex:1];
[vc.view setNeedsDisplay];
[self.tabBarController setSelectedViewController:vc];
}
我尝试了此代码部分但无法正常工作。 ProfileSide 类第 3 项标签栏控制器的名称。
ProfileSide *vc1 = [self.storyboard instantiateViewControllerWithIdentifier:@"meScreen"];
[self presentViewController:vc1 animated:YES completion:nil];
也有这个代码部分,但是当我使用这个标签栏时会消失。
【问题讨论】:
-
首先是的可以做到这一点...另一个,向我们展示您到目前为止所做的尝试...
-
编辑了我的问题,您可以查看
-
仅当您在视图的
-drawRect:方法中执行自定义绘图时才调用-setNeedsDisplay,并且该视图需要重绘其视图。 -
ProfileSide *vc = (ProfileSide *)[[self.tabBarController viewControllers]objectAtIndex:1]; [vc.view setNeedsDisplay];当我再次这样运行时不起作用
标签: ios objective-c xcode