ios - Offset UITableView Content When Keyboard Appears -
hi i'm getting error: property 'editingindexpath' not found on object of type 'viewcontroller *' line:
[self.tableview scrolltorowatindexpath:self.editingindexpath atscrollposition:uitableviewscrollpositiontop animated:yes];
the error has call: self.editingindexpath
how fix error?
- (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(keyboardwillshow:) name:uikeyboardwillshownotification object:nil]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(keyboardwillhide:) name:uikeyboardwillhidenotification object:nil]; } - (void)keyboardwillshow:(nsnotification *)notification { cgsize keyboardsize = [[[notification userinfo] objectforkey:uikeyboardframebeginuserinfokey] cgrectvalue].size; uiedgeinsets contentinsets; if (uiinterfaceorientationisportrait([[uiapplication sharedapplication] statusbarorientation])) { contentinsets = uiedgeinsetsmake(0.0, 0.0, (keyboardsize.height), 0.0); } else { contentinsets = uiedgeinsetsmake(0.0, 0.0, (keyboardsize.width), 0.0); } self.tableview.contentinset = contentinsets; self.tableview.scrollindicatorinsets = contentinsets; [self.tableview scrolltorowatindexpath:self.editingindexpath atscrollposition:uitableviewscrollpositiontop animated:yes]; } - (void)keyboardwillhide:(nsnotification *)notification { self.tableview.contentinset = uiedgeinsetszero; self.tableview.scrollindicatorinsets = uiedgeinsetszero; }
compiler tells everything. define editingindexpath
property.
@property(nonatomic, strong) nsindexpath *editingindexpath
Comments
Post a Comment