2012-10-31 7 views
0

У меня есть UIScrollView, и когда я запускаю свое приложение, просмотр прокрутки отлично работает. Когда я иду добавить две кнопки в вид прокрутки, внизу, а другой вверху, способность прокрутки уходит. Я еще не звонил на кнопки. Я просто хотел увидеть прокрутку в действииUIScroll View не будет прокручиваться при добавлении элементов

Не знаю, почему это происходит.

Вот мой код.

.h

@interface ViewController : UIViewController { 
IBOutlet UIScrollView *theScroller; 
} 

@end 

.m

@implementation ViewController 

- (void)viewDidLoad 
{ 
[theScroller setScrollEnabled:YES]; 
[theScroller setContentSize:CGSizeMake(320, 900)]; 
[super viewDidLoad]; 
// Do any additional setup after loading the view, typically from a nib. 
} 

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

@end 

ответ

0

изменение следующих изменений:

.h

@interface ViewController : UIViewController 
{ 


    IBOutlet UIScrollView *theScroller; 

} 


@property(nonatomic,retain)IBOutlet UIScrollView *theScroller; // Add this Line 

. м

**#import "ViewController.h" 
@interface ViewController() 
@end 
@implementation ViewController 
@synthesize theScroller; // Add this Line 

- (void)viewDidLoad 

{ 
    [super viewDidLoad]; 


    [theScroller setScrollEnabled:YES]; 
    [theScroller setContentSize:CGSizeMake(320, 900)]; 
    [super viewDidLoad]; 

} 

В вашем XIB;

  1. Набор Делегат и ссылка Правильно

enter image description here

 Смежные вопросы

  • Нет связанных вопросов^_^