开发者

How to add (insert) view to the superview

I want to know how to add imageview to the super view.开发者_开发问答 this is how program works. 1.superview have childview 2.choose liitle picture from the childview 3.remove child view and send selected picture to the superview I just dont know where to begin, please help me guys.

#import "SecondLevelView.h"
#import "StickerViewController.h"

@implementation SecondLevelView

-(IBAction)switchStickerView:(id)sender{

    StickerViewController *stickerController = [[StickerViewController alloc] initWithNibName:@"StickerViewController" bundle:nil];

    self.stickerViewController = stickerController;
    [self.view insertSubview:stickerViewController.view atIndex:1];
    [stickerController release];
    [super viewDidLoad];

}

so this is rootview. it has toolbar to call stickerViewController. I draw picture for StickerViewcontroller through stickerView.h file. so, what Im stuck on is, when I choose picture from code in stickerview.m, I want ro send picture to secondlevelview.


[viewToMove retain];  //since detaching from super will decrement retain count. 
UIView *myRootView = [viewToMove superview];
[viewToMove removeFromSuperview];
[myRootView addSubview: viewToMove];
[viewToMove release];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜