-(void)viewDidLoad{
[self.view setBackgroundColor:[UIColor whiteColor]];
isInFullScreenMode = FALSE;
messageArrayCollection = [[NSMutableArray alloc] init];
for (int i = 1; i <= 18; i++) {
MessageModel* messageModel1 = [[MessageModel alloc] init];
messageModel1.messageID= i;
messageModel1.userName = @"Kimberly A. Mann";
messageModel1.userImage = @"MWMStaff.png";
messageModel1.createdAt = @"06/07/2011 at 01:00 AM";
messageModel1.content = @"After raising her two children, Kim joined the Monument Wealth Management team in 2009, managing the book keeping and other office tasks.In her free time, Kim enjoys spending time with her family, attending festive events and parades, and catching up on her favorite shows – Dancing with the Stars and Smash, to name a few";
[messageArrayCollection addObject:messageModel1];
//[messageModel1 release];
}
[self buildPages:messageArrayCollection];
flipper = [[AFKPageFlipper alloc] initWithFrame:self.view.bounds];
flipper.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
flipper.dataSource = self;
[self.view addSubview:flipper];
}
-(void)showViewInFullScreen:(UIViewExtention*)viewToShow withModel:(MessageModel*)model{
NSLog(@" in show view inFullscreen");
if (!isInFullScreenMode) {
isInFullScreenMode = TRUE;
CGRect bounds = [UIScreen mainScreen].bounds;
if (self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft || self.interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
CGFloat width = bounds.size.width;
bounds.size.width = bounds.size.height;
bounds.size.height = width;
}
fullScreenBGView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, bounds.size.width, bounds.size.height)];
fullScreenBGView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[fullScreenBGView setBackgroundColor:RGBACOLOR(0,0,0,0.6)];
fullScreenBGView.alpha = 0;
[self.view addSubview:fullScreenBGView];
viewToShowInFullScreen = viewToShow;
viewToShowInFullScreen.originalRect = viewToShowInFullScreen.frame;
viewToShowInFullScreen.isFullScreen = TRUE;
FullScreenView* fullView = [[FullScreenView alloc] initWithModel:model];
fullView.frame = viewToShowInFullScreen.frame;
fullView.viewToOverLap = viewToShowInFullScreen;
fullView.fullScreenBG = fullScreenBGView;
fullScreenView = fullView;
[self.view addSubview:fullView];
[self.view bringSubviewToFront:fullScreenBGView];
[self.view bringSubviewToFront:fullView];
[UIView beginAnimations:@"SHOWFULLSCREEN" context:NULL];
[UIView setAnimationDuration:0.40];
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:nil cache:NO];
fullScreenBGView.alpha = 1;
if (self.interfaceOrientation == UIInterfaceOrientationPortrait || self.interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
[fullView setFrame:CGRectMake(10, 50, 768-20, 1004-60)];
}else {
[fullView setFrame:CGRectMake(10, 50, 1024-20, 746-60)];
}
[fullScreenView rotate:self.interfaceOrientation animation:YES];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(animationEnd:finished:context:)];
[UIView commitAnimations];
}
}
showViewInFullScreen
画面の特定の領域をタップしてフルスクリーンビューを表示するメソッドに到達しますが、そこに到達するとメソッド[self.view addSubview:flipper];
に戻るためviewDidload
、このメソッドでコード全体を実行することはできません.そして、動作によると、これに行くべきではありませんなぜ私はそれを追加することができませんsubview
.動作について多くを検索しました.現在のウィンドウ[self.view addsubView]
に追加subview
する必要があります.実際に何が起こっているのかわかりません.誰かがここで何が間違っているかを示唆できる場合..