2014-10-30 87 views
0

我有這個奇怪的問題,這是最近幾天驅動我的堅果。嘗試了論壇中提出的各種各樣的東西和竅門,但迄今爲止沒有運氣。基本上我有tabbarview控制器與桌面視圖時,用戶單擊它所需的表格行到詳細畫面。我在屏幕底部有四個固定按鈕,但這些按鈕不可點擊或不能識別觸摸。我想這是與主屏幕尺寸或應用程序視圖框架。如果我將按鈕放在大約CGRectMake(0,330,320,50)處,這意味着在底部留下大約50個淨空間然後它們就可以工作。下面是針對此問題相關的代碼 -UIView底部不可點擊

//Bottom fixed Bar and Buttons// 
self.edgesForExtendedLayout=UIRectEdgeNone; 

UIImageView *lineImg=[[UIImageView alloc]init]; 
//lineImg.frame=CGRectMake(0, 748, 320, 2); 
[lineImg setBackgroundColor:[UIColor colorWithRed:0.9058 green:0.4705 blue:0 alpha:1.0]]; 
[self.view addSubview:lineImg]; 

    addFavBtn=[UIButton buttonWithType:UIButtonTypeCustom]; 
[addFavBtn setBackgroundColor:[UIColor colorWithRed:0.0392 green:0.1686 blue:0.2196 alpha:1.0]]; 
[addFavBtn setTitle:@"Add Fav" forState:UIControlStateNormal]; 
[addFavBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 
addFavBtn.titleLabel.textAlignment=NSTextAlignmentCenter; 
addFavBtn.titleLabel.font=[UIFont fontWithName:@"MyriadPro-Regular" size:20]; 
[addFavBtn addTarget:self action:@selector(addFavBtnClick) forControlEvents:UIControlEventTouchUpInside]; 
[self.view addSubview:addFavBtn]; 
addFavBtn.userInteractionEnabled=YES; 



UIImageView *lineImg1=[[UIImageView alloc]init]; 
//lineImg1.frame=CGRectMake(80, 750, 1, 35); 
[lineImg1 setBackgroundColor:[UIColor whiteColor]]; 
[self.view addSubview:lineImg1]; 

shareBtn=[UIButton buttonWithType:UIButtonTypeCustom]; 
//shareBtn.frame=CGRectMake(81, 750, 79, 35); 
[shareBtn setBackgroundColor:[UIColor colorWithRed:0.0392 green:0.1686 blue:0.2196 alpha:1.0]]; 
[shareBtn setTitle:@"Share" forState:UIControlStateNormal]; 
[shareBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 
shareBtn.titleLabel.textAlignment=NSTextAlignmentCenter; 
shareBtn.titleLabel.font=[UIFont fontWithName:@"MyriadPro-Regular" size:20]; 
[shareBtn addTarget:self action:@selector(shareBtnClick:) forControlEvents:UIControlEventTouchUpInside]; 
[self.view addSubview:shareBtn]; 

UIImageView *lineImg2=[[UIImageView alloc]init]; 
//lineImg2.frame=CGRectMake(160, 748, 1, 35); 
[lineImg2 setBackgroundColor:[UIColor whiteColor]]; 
[self.view addSubview:lineImg2]; 


reviewBtn=[UIButton buttonWithType:UIButtonTypeCustom]; 
//reviewBtn.frame=CGRectMake(161, 750, 79, 35); 
[reviewBtn setBackgroundColor:[UIColor colorWithRed:0.0392 green:0.1686 blue:0.2196 alpha:1.0]]; 
[reviewBtn setTitle:@"Review" forState:UIControlStateNormal]; 
[reviewBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 
reviewBtn.titleLabel.textAlignment=NSTextAlignmentCenter; 
reviewBtn.titleLabel.font=[UIFont fontWithName:@"MyriadPro-Regular" size:20]; 
[reviewBtn addTarget:self action:@selector(reviewBtnClick) forControlEvents:UIControlEventTouchUpInside]; 
[self.view addSubview:reviewBtn]; 

UIImageView *lineImg3=[[UIImageView alloc]init]; 
// lineImg3.frame=CGRectMake(240, 750, 1, 35); 
[lineImg3 setBackgroundColor:[UIColor whiteColor]]; 
[self.view addSubview:lineImg3]; 

helpBtn=[UIButton buttonWithType:UIButtonTypeCustom]; 
//helpBtn.frame=CGRectMake(241, 750, 79, 35); 
[helpBtn setBackgroundColor:[UIColor colorWithRed:0.0392 green:0.1686 blue:0.2196 alpha:1.0]]; 
[helpBtn setTitle:@"Help" forState:UIControlStateNormal]; 
[helpBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 
helpBtn.titleLabel.textAlignment=NSTextAlignmentCenter; 
helpBtn.titleLabel.font=[UIFont fontWithName:@"MyriadPro-Regular" size:20]; 
[helpBtn addTarget:self action:@selector(helpViewBtnClick) forControlEvents:UIControlEventTouchUpInside]; 
[self.view addSubview:helpBtn]; 

UIImageView *lineImgLast=[[UIImageView alloc]init]; 
//lineImgLast.frame=CGRectMake(0, 748, 320, 2); 
[lineImgLast setBackgroundColor:[UIColor colorWithRed:0.0392 green:0.1686 blue:0.2196 alpha:1.0]]; 
[self.view addSubview:lineImgLast]; 



imageNameDetailArray=[[NSMutableArray alloc]init]; 
parkListDetailArray=[[NSMutableArray alloc]init]; 
parkListViseDetailArray=[[NSMutableArray alloc]init]; 

self.responseData=[NSMutableData data]; 


//get the size of the screen 
CGSize result = [[UIScreen mainScreen] bounds].size; //to see the actual screen size - returns 568 
CGSize frame = [[UIScreen mainScreen] applicationFrame].size; //to see the application frame size - returns 548 
//UIScreen *screen = [UIScreen mainScreen]; 
//CGRect fullScreenRect = screen.bounds; 

[self.view setAutoresizingMask:UIViewAutoresizingFlexibleHeight]; 

NSLog(@"mainscreen size - %f",result.height); 
NSLog(@"Application frame size - %f",frame.height); 

int newSize=cs+50; 
int fBar=result.height-50; 

homeBg.frame=CGRectMake(0,0, 320, result.height); 

//set the height of the scroller view 
parkViewScrollView.frame=CGRectMake(0, 63, 320, result.height-128); 
parkViewScrollView.contentSize=CGSizeMake(320, newSize); 


lineImg.frame=CGRectMake(0, fBar, 320, 2); 
addFavBtn.frame=CGRectMake(0, fBar+2, 79, 48); 
lineImg1.frame=CGRectMake(80, fBar+2, 1, 48); 
shareBtn.frame=CGRectMake(81, fBar+2, 79, 48); 
lineImg2.frame=CGRectMake(160, fBar+2, 1, 48); 
reviewBtn.frame=CGRectMake(161, fBar+2, 79, 48); 
lineImg3.frame=CGRectMake(240, fBar+2, 1, 48); 
helpBtn.frame=CGRectMake(241, fBar+2, 79, 48); 

http://i.stack.imgur.com/kOp9P.png

+0

這些按鈕是否顯示在鏈接的圖像中,隱藏了標籤欄控制器的選項卡?如果是這樣,你是如何讓他們不在標籤後面的? – rdelmar 2014-10-30 04:41:50

+0

您是否嘗試將按鈕視圖置於主視圖前方? – Gamerlegend 2014-10-30 05:02:48

+0

感謝您的回覆,我已經嘗試過,但沒有運氣。 detailview中沒有tabbar視圖 - 「code」[self.view bringSubviewToFront:addFavBtn]; [self.view bringSubviewToFront:shareBtn]; [self.view bringSubviewToFront:reviewBtn]; [self.view bringSubviewToFront:helpBtn]; 'code' – Tajuddin 2014-10-30 05:44:50

回答

0

謝謝大家的響應。有趣的是,即使tabbar仍然隱藏,我無法使用該按鈕的保留空間。在推送細節視圖控制器之前,我已經使用了以下行。這似乎工作正常,我現在可以點擊所有按鈕。

//this one line of code did the trick after spending hours of time 

objDetailView.hidesBottomBarWhenPushed = YES; [self.navigationController pushViewController:objDetailView animated:YES];