开发者

iPhone Add View using another View

开发者 https://www.devze.com 2023-03-08 20:32 出处:网络
I have a tabbar application with individual views. So I have three views: MainWindow.xib (tab click) Favorites.xib (button click) AddFavorites.xib

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

精彩评论

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