开发者

ios warning calling init method of a uiviewcontroller

I have my custom viewcontroller declared like this:

@interface DetailViewControllerSpeciality2 : UIViewController <UITableViewDelegate, UITableViewDataSource> {
}

and I create a new instance like this:

DetailViewControllerSpeciality2 *detailVi开发者_如何学GoewControllerSpeciality = [[DetailViewControllerSpeciality2 alloc] init];

but xcode tell me a warning:

multiple methods named '-init' found

but I don't have declared a -init method...


You aren't showing all the error message, nor the relevant code. Still, there is enough evidence to make an educated guess.

More likely than not, you have an init method declared like:

 - (DetailViewControllerSpeciality2 *) init;

The compiler is complaining because that conflicts with NSObject's init (that returns id).

Declare your init to return id and the compiler should be happy. If that isn't the problem, post more code.


try this.

[[DetailViewControllerSpeciality2 alloc] initWithNibName:nil bundle:nil];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜