2013-08-07 93 views
0

我不明白爲什麼我的項目不起作用。 我可以打開窗口,但滾動視圖不會滾動,這意味着我看不到我的UI的底部。爲什麼?我閱讀類似問題的答案,但他們沒有幫助我解決我的問題。Objective-c UIScrollView現在滾動也不垂直也不水平

這是DETAILVC.H

@interface DetailVC : UIViewController { 
IBOutlet UIImageView *iv_main, *iv_ratings; 
IBOutlet UITextField *tf_name, *tf_dob, *tf_age, *tf_weight, *tf_height,*tf_birthplace; 
IBOutlet UITextView *tv_description; 
IBOutlet UIButton *but_movies, *but_edit; 
IBOutlet UINavigationBar *navbar; 
IBOutlet UIScrollView *scrollView; 

} 

@property (nonatomic, retain) IBOutlet UIImageView *iv_main, *iv_ratings; 
@property (nonatomic, retain) IBOutlet UITextField *tf_name, *tf_dob, *tf_age, *tf_weight, *tf_height, *tf_birthplace; 
@property (nonatomic, retain) IBOutlet UITextView *tv_description; 
@property (nonatomic, retain) IBOutlet UIButton *but_movies, *but_edit; 
@property (nonatomic, retain) IBOutlet UINavigationBar *navbar; 
@property (nonatomic, retain) IBOutlet UIScrollView *scrollView; 
@end 

這是DETAILVC.M

#import "DetailVC.h" 

@interface DetailVC() 

@end 

@implementation DetailVC 

@synthesize iv_main, iv_ratings, tf_age, tf_birthplace, tf_dob, tf_height, tf_name, tf_weight, tv_description, but_edit, but_movies,navbar, scrollView; 

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 
{ 
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 
if (self) { 
    // Custom initialization 
} 
return self; 


} 

- (void)viewDidLoad 
{ 
[super viewDidLoad]; 
// Do any additional setup after loading the view from its nib. 
scrollView.contentSize = CGSizeMake(320, 1000); 

} 

- (void)didReceiveMemoryWarning 
{ 
[super didReceiveMemoryWarning]; 
// Dispose of any resources that can be recreated. 
} 

@end 

------連接檢查員
http://s18.postimg.org/qjzrdz9a1/Schermata_2013_08_07_alle_16_47_19.png

----- -Scroll查看歸因檢查員
http://s8.postimg.org/5eniaq8r9/Schermata_2013_08_07_alle_17_35_04.png

+0

你有沒有保證用戶交互啓用並滾動啓用 –

+0

一些奇怪的原因,現在它workink我只是改變了 本 scrollView.contentSize = CGSizeMake(320,1000); 與此 [scrollView setContentSize:CGSizeMake(320,800)]; 現在...我怎麼能避免它顯示底部視圖時,它滾動了太多?這裏是一張圖片來展示我的意思 – Mario

+0

這就是圖片 http://s18.postimg.org/fii3vmf21/image.jpg – Mario

回答

0

您的UIScrollView的框架是否有與contentSize相同的大小?如果是的話,UIScrollView會認爲它有足夠的框架來顯示所有的內容。