Wednesday, 22 September 2010

UIScrollView not scrolling


i have couple images adding uiscrollview 320w * 180h, nice letter boxed photos. photos added , looks won't scroll.

in viewdidload have code

code:
[self.view addsubview:[self scrollviewphotos]];
to test far added couple of images nsmutablearray. can see returns images , can offset images horizontally see both there. reason won't scroll.

code:
  -(uiscrollview *)scrollviewphotos{      int numofimages, imageysize;            numofimages = 2;      imageysize = 320;            nsmutablearray *imagesarray = [[nsmutablearray alloc] init];      uiimage *image1= [uiimage imagenamed:@"food_one_small.jpg"];      uiimage *image2= [uiimage imagenamed:@"food_two_small.jpg"];      [imagesarray addobject:image1];      [imagesarray addobject:image2];        uiscrollview *clientphotos = [[uiscrollview alloc] initwithframe:cgrectmake(0, 200, 640, 180)];      clientphotos.pagingenabled = yes;            (int = 0; < numofimages; i++) {          cgfloat imagestartpoint = imageysize * i;                    uiimageview *itemtoadd = [[uiimageview alloc] initwithframe:cgrectmake(imagestartpoint, 0, 320, 180)];          itemtoadd.image = [imagesarray objectatindex:i];                    [clientphotos addsubview: itemtoadd];      }            return clientphotos;  }
 

did set contentsize?
 


Forums iPhone, iPad, and iPod Touch iOS Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

No comments:

Post a Comment