开发者

iPhone Add View using another View

I have a tabbar application with individual views.

So I have three views:

MainWindow.xib (tab click) Favorites.xib (button click) AddFavorites.xib

How would I get the Button click to work on the favorites?

Here is my current code and it always crashes.

#import "FavoritesView.h"
#import "FavoritesAddView.h"

@implementation FavoritesView

@synthesize favAddView;

-(IBAction) addButton:(id)sender
{
    if (self.favAddView == nil)
    {
        FavoritesAddView *fView = [[FavoritesAddView alloc]initWithNibName:@"Favorites" bundle:nil];

        self.favAddView = fView;

        [fView release];
    }

    [super.view addSubview:favAddVi开发者_开发百科ew.view];
}

It gives me an error at the line: [super.view addSubview:favAddView.view];

Error: Program received "SIGABRT"


Probably the last line should be [self.view.superview addSubview:favAddView.view].

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜