objective c - IOS 8 ScrollView fixed content -
hi developing ios application. using scrollview. encountered problem on ios version 8. added in following way scroll content inside. scroll in first picture looks steady. other images scrolling.
nsarray *aimageurls = (nsarray *)[_datasource arraywithimageurlstrings]; if([aimageurls count] > 0) { [_scrollview setcontentsize:cgsizemake(_scrollview.frame.size.width * [aimageurls count], _scrollview.frame.size.height)]; (int = 0; < [aimageurls count]; i++) { cgrect imageframe = cgrectmake(_scrollview.frame.size.width * i, 0, _scrollview.frame.size.width, _scrollview.frame.size.height); uiimageview *imageview = [[uiimageview alloc] initwithframe:imageframe]; [imageview setbackgroundcolor:[uicolor clearcolor]]; [imageview setcontentmode:[_datasource contentmodeforimage:i]]; [imageview settag:i]; [imageview setimagewithurl:[nsurl urlwithstring:(nsstring *)[aimageurls objectatindex:i]]]; // add gesturerecognizer imageview uitapgesturerecognizer *singletapgesturerecognizer = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(imagetapped:)]; [singletapgesturerecognizer setnumberoftapsrequired:1]; [imageview addgesturerecognizer:singletapgesturerecognizer]; [imageview setuserinteractionenabled:yes]; [_scrollview addsubview:imageview]; } [_countlabel settext:[nsstring stringwithformat:@"%lu", (unsigned long)[[_datasource arraywithimageurlstrings] count]]]; _pagecontrol.numberofpages = [(nsarray *)[_datasource arraywithimageurlstrings] count]; _pagecontrol.hidden = ([(nsarray *)[_datasource arraywithimageurlstrings] count] > 0?no:yes); }
Comments
Post a Comment