Reputation: 31
I have a scrollview and it is full off buttons. this scrollview work iphone but not work on ipad
#define scrollViewSizeForiPad 1000
#define scrollViewSizeForiPhone 600
#define locationButtonSizeForiPhone 50
#define locationButtonSizeForiPad 30
i added buttons like this
lc_button.frame = CGRectMake(0, 0, buttonSize, buttonSize);
[_uiScrollForLocations addSubview:lc_button];
and some labels
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad){
buttonSize = buttonWidthHeightForiPad;
lc_label.font = [UIFont systemFontOfSize:14];
lc_label.frame = CGRectMake(3, 100, buttonSize, 20);
} else {
buttonSize = buttonWidthHeightForiPhone;
lc_label.font = [UIFont systemFontOfSize:9];
lc_label.frame = CGRectMake(8, 50, buttonSize, 10);
}
[_uiScrollForLocations addSubview:lc_label];
-(void) showLocations:(NSMutableArray *)lc_array {
[self hideAllLocations];
[self addButtonToView:lc_array whichView:_uiScrollForLocations type:@"Location"];
CGSize pagesScrollViewSize = _uiScrollForLocations.frame.size;
int viewHeight;
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad){
viewHeight = buttonWidthHeightForiPad;
} else {
viewHeight = buttonWidthHeightForiPhone;
}
_uiScrollForLocations.contentSize = CGSizeMake(pagesScrollViewSize.width, viewHeight);}
Upvotes: 0
Views: 88
Reputation: 360
It happen because contentSize <= _uiScrollForLocations.frame
Need set
_uiScrollForLocations.alwaysBounceVertical = YES
or
_uiScrollForLocations.alwaysBounceHorizontal = YES
Upvotes: 1