Xcode-警告问题
【腾讯云】亏本大甩卖,服务器4核16G 1年370元(带宽12M,系统盘120GB SSD盘,月流量2000GB)!!!!!!
云产品 配置 价格
服务器 1核2G,带宽5M,系统盘50GB SSD盘,月流量500GB 38元/年
MySQL 1核1G 19元/年
服务器 16核32G,带宽18M,系统盘250GB SSD盘,月流量5000GB 1197元/年
点我进入腾讯云,查看更多详情

I have a navigation controller that utilizes an if statement to switch between the different views, and when i run it it comes up with a warning on the line:

ROSS_APP_7AppDelegate *delegate = [[UIApplication sharedApplication] delegate];

warning: type 'id ' does not conform to the 'UITabBarControllerDelegate' protocol

I'd like some help on how to get rid of this warning. Here is the whole if statement:

if(indexPath.row == 0)
{
    MapDetailController *mapD = [[MapDetailController alloc] initWithNibName:@"MapDetailController" bundle:nil];
    self.mapDetailController = mapD;
    [mapD release];

    mapDetailController.title = [NSString stringWithFormat:@"%@", [moreArray objectAtIndex:row]];

    ROSS_APP_7AppDelegate *delegate = [[UIApplication sharedApplication] delegate];
    [delegate.moreNavController pushViewController:mapDetailController animated:YES];


}

Thanks

EDIT: Here is what my AppDelegate looks like (response to answer #2)

#import <UIKit/UIKit.h>
@class MoreNavController;
@interface ROSS_APP_7AppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {
UIWindow *window;
IBOutlet UITabBarController *tabBarController;
IBOutlet MoreNavController *moreNavController;
}


@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;
@property (nonatomic, retain) IBOutlet MoreNavController *moreNavController;
@end

#0

You probably forgot to have your app delegate conform to the UITabBarControllerDelegate protocol.

To implement it, your appDelegate header should look like this (the @interface declaration is the relevant line):

#import ...

@interface ROSS_APP_7AppDelegate : AppDelegate_Shared <UITabBarControllerDelegate> 
{
    ....
}

@property(nonatomic, retain) .....

@end

You might be using AppDelegate_Shared / AppDelegate_iPhone / AppDelegate_iPad so bear in mind that the above example considers a shared app delegate

EDIT:

After seeing your comment,

Try replacing:

ROSS_APP_7AppDelegate *delegate = [[UIApplication sharedApplication] delegate];

With this:

ROSS_APP_7AppDelegate *delegate = (ROSS_APP_7AppDelegate*)[[UIApplication sharedApplication] delegate];

Does typecasting the return like this get rid of your warning?

#1

Have you tried casting the delegate as in:

(id)[[UIApplication sharedApplication] delegate];

???

推荐文章

我的java套接字应用程序

我的java套接字应用程序

推荐文章

依赖散列来识别文件有多安全?

依赖散列来识别文件有多安全?

推荐文章

如何使用“button_to”更新布尔值

如何使用“button_to”更新布尔值

推荐文章

由于保留关键字,MySQL查询失败?

由于保留关键字,MySQL查询失败?

推荐文章

如何创建带有图像和文本的切换按钮?

如何创建带有图像和文本的切换按钮?

推荐文章

Rails是否为网络爬虫和机器人创建会话?

Rails是否为网络爬虫和机器人创建会话?

推荐文章

谷歌浏览器中的西里尔网址?

谷歌浏览器中的西里尔网址?

推荐文章

Erlang有向图原子性和隔离保证

Erlang有向图原子性和隔离保证

推荐文章

linq语法选项

linq语法选项

推荐文章

动态呈现的MVC 3验证不起作用

动态呈现的MVC 3验证不起作用

推荐文章

Java首选项管理器

Java首选项管理器

推荐文章

未调用NSTextField自动完成委托方法

未调用NSTextField自动完成委托方法

推荐文章

如何设置Hudson/Jenkins授权来克隆mercurial存储库

如何设置Hudson/Jenkins授权来克隆mercurial存储库

推荐文章

如何在Magento中使用像head.js或labjs这样的JavaScript加载程序

如何在Magento中使用像head.js或labjs这样的JavaScript加载程序

推荐文章

从脚本值分配php值

从脚本值分配php值

推荐文章

C++模板,对象分配的“静态”和“动态”

C++模板,对象分配的“静态”和“动态”