![](/img/trans.png)
[英]Correct way to show Login Screen followed by UITabbarController menu
[英]Correct way to address top UITabBarController view for showFromTabBar
主应用程序委托有一个名为tabBarController(NewsUKDelegate.m)的UITabBarController
第一个选项卡加载一个UIViewController,然后依次添加一个UITableView(FirstViewController.m)
选择单元格后,UITableView会加载子类UIViewController(StoryController.m)
然后,我从Sharekit加载共享操作表
NSURL *url = [NSURL URLWithString:link];
SHKItem *item = [SHKItem URL:url title:storyTitle];
SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];
[actionSheet showFromTabBar:rootView];
[actionSheet showFromTabBar:[self view]];
它可以工作,但操作表从顶部加载,这似乎是错误的,但重要的是它抱怨
incompatible Objective-C types 'struct UIView *', expected 'struct UITabBar *'
when passing argument 1 of 'showFromTabBar:' from distinct Objective-C type
我试着与
UIWindow *topWindow = [[UIApplication sharedApplication] keyWindow];
if (topWindow.windowLevel != UIWindowLevelNormal)
{
NSArray *windows = [[UIApplication sharedApplication] windows];
for(topWindow in windows)
{
if (topWindow.windowLevel == UIWindowLevelNormal)
break;
}
}
UIView *rootView = [[topWindow subviews] objectAtIndex:0];
NSLog(@"Root view is: %@",rootView);
[actionSheet showFromTabBar:rootView];
[actionSheet showFromTabBar:NewsUKDelegate.tabBarController];
[actionSheet showFromTabBar:NewsUKDelegate.view];
但是我只是崩溃,解决主应用程序的委托工具栏的正确方法是什么
采用,
[actionSheet showFromTabBar:self.tabBarController.tabBar];
((myAppDelegate *)[UIApplication sharedApplication]).delegate.tabBar
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.