user3349668
user3349668

Reputation: 147

UIScrollView not Working in ipad

Hi in my app i have a contact form in that i kept scroll view for the user to scroll the long content but its not working before the i have used same code for my iphone application but now I'm working on ipad its not working.

@property (strong, nonatomic) IBOutlet UIScrollView *scroll;


     - (void)viewDidLoad
  {
     [super viewDidLoad];

     [scroll setScrollEnabled:YES];
     [scroll setContentSize:CGSizeMake(600, 800)];

   }

please tell me where I'm doing wrong why its not working.

Thanks.

Upvotes: 0

Views: 471

Answers (2)

- (void)viewDidLoad
{
    [super viewDidLoad];

   // Make scroll view size to main view size   
    scroll.frame = self.view.bounds;

    [scroll setScrollEnabled:YES];

    //Double the height of iPad or Iphone
    [scroll setContentSize:CGSizeMake(self.view.bounds.size.width, self.view.bounds.size.height*2)];

    //Or
    [scroll setContentSize:CGSizeMake(self.view.bounds.size.width, your Large Height)];


}

Upvotes: 0

Shanti K
Shanti K

Reputation: 2918

The content size should be greater than the frame size of the scrollview. Only then the scrolling will be enabled.

Upvotes: 1

Related Questions