我有一個視圖控制器和一個UIView現在在我的ViewController當我點擊barButton比第二個視圖將Apear像彈出,現在我想添加頁面控制器和滾動視圖在第二個看來,我的第二個觀點是不UIViewController的,但它是UIView.so我怎麼能做到這一點...想在UIView編程實現UIPageController和UIScrollView在ios
我的第一個觀點是「ImageViewController」和第二種觀點是「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;
}
請***不要濫用Xcode標籤*** – 2012-12-04 14:42:17
什麼標籤,我沒有做過任何... –
你用這個問題的'xcode'標籤,而它與Xcode無關。今後請避免這種情況。 – 2012-12-04 14:51:27