iphone - iOS - UITableView scrollbar goes out of screen -
i new ios , have serious problem don't know why happened, tried find out reason behind failed.
i creating app in iphone take tweet of particular user using twitter api, have no problem in getting json data, able display in uitableview in ios 6 using storyboard, had changed row height 200 px, can display user name text tweet , image.
but when scroll or down uitableviewcell scrollbar goes out of screen.
what may reason?how can fix it?
screenshots
first shows when app loads scrollbar takes full screen

when scroll out of screen

at last gets out of screen

uitableview delegate methods
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { nsmutablearray *name,*time,*tweet,*image; name=[[nsmutablearray alloc]init]; time=[[nsmutablearray alloc]init]; tweet=[[nsmutablearray alloc]init]; image=[[nsmutablearray alloc]init]; static nsstring *cellidentifier = @"simpletableitem"; uitableviewcell* cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; (user *usermodel in self.user) { [name addobject:usermodel.namestr]; [image addobject:usermodel.imagestr]; } (json *jsonmodel in self.json) { [tweet addobject:jsonmodel.tweetstr]; [time addobject:jsonmodel.timestr]; } // fetch using gcd dispatch_queue_t downloadthumbnailqueue = dispatch_queue_create("get photo thumbnail", null); dispatch_async(downloadthumbnailqueue, ^{ nsstring *imageurl=[image objectatindex:indexpath.row]; nsurl *url = [nsurl urlwithstring:imageurl]; nsdata *data = [nsdata datawithcontentsofurl:url]; uiimage *img = [[uiimage alloc] initwithdata:data]; dispatch_async(dispatch_get_main_queue(), ^{ uiimageview *image = (uiimageview *)[cell.contentview viewwithtag:5]; image.image=img; [cell setneedslayout]; [uiapplication sharedapplication].networkactivityindicatorvisible = no; [spinner stopanimating]; }); }); self.labelname = (uilabel *)[cell.contentview viewwithtag:10]; [self.labelname settext:[nsstring stringwithformat:@"%@", [name objectatindex:indexpath.row]]]; self.labeltime = (uilabel *)[cell.contentview viewwithtag:11]; [self.labeltime settext:[nsstring stringwithformat:@"%@", [time objectatindex:indexpath.row]]]; self.labeltweet = (uilabel *)[cell.contentview viewwithtag:12]; [self.labeltweet settext:[nsstring stringwithformat:@"%@", [tweet objectatindex:indexpath.row]]]; cell.imageview.frame=cgrectmake(0, 0, 40, 40); cell.textlabel.linebreakmode=nslinebreakbywordwrapping; return cell; } -(cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath{ cgfloat rowheight=self.labelname.frame.size.height+self.labeltime.frame.size.height+self.labeltweet.frame.size.height+50; return rowheight; }
well scroll goes out of screen means tableview frame larger screen size
set frame of tableview using setframe: method
Comments
Post a Comment