2番目のビューがポップアップのように表示されるよりもbarButtonをクリックすると、ViewControllerに1つのViewControllerと1つのUIViewがあります。2番目のビューにPageControllerとScrollViewを追加したいのですが、2番目のビューはUIViewControllerではなく、UIView.soです。どうやってやるの...
私の最初のビューは「ImageViewController」で、2番目のビューは「PopupView」です。
ImageViewController.mで
#import "PopupView.h"
@implementation ImageViewController
- (void)viewDidLoad
{
UIBarButtonItem *clipArt = [[UIBarButtonItem alloc] initWithTitle:@"Clip Art"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(popUpView:)];
}
- (void)popUpView:(id)sender {
CGRect * imageFrame = CGRectMake(10, 90, 300, 300);
PopupView *popUpView = [[PopupView alloc] initWithFrame:imageFrame];
[self.view addSubview:popUpView];
}
そしてPopupView.mで
- (id)initWithFrame:(CGRect)frame
{
if (self) {
CGRect * imageFrame = CGRectMake(0, 0, 300, 300);
self = [super initWithFrame:frame];
UIImageView *starImgView = [[UIImageView alloc] initWithFrame:imageFrame]; //create ImageView
starImgView.alpha =0.8;
starImgView.layer.cornerRadius = 15;
starImgView.layer.masksToBounds = YES;
starImgView.image = [UIImage imageNamed:@"black"];
[self addSubview:starImgView];
self.backgroundColor = [UIColor clearColor];
}
return self;
}