求助关于scrollToRowAtIndexPath 不执行
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了求助关于scrollToRowAtIndexPath 不执行相关的知识,希望对你有一定的参考价值。
参考技术A - (void) keyboardWasShown:(NSNotification *) notifNSDictionary *info = [notif userInfo];
NSValue *value = [info objectForKey:UIKeyboardFrameBeginUserInfoKey];
CGSize keyboardSize = [value CGRectValue].size;
//NSLog(@"keyBoard:%f", keyboardSize.height); //216
//keyboardWasShown = YES;
CGRect frame = self.myTableView.frame;
frame.size.height -= keyboardSize.height;
self.myTableView.frame = frame;
NSIndexPath *localIndexPath = [NSIndexPath indexPathForRow:[self.array count] inSection:0];
UITableViewCell *cell = [self.myTableView cellForRowAtIndexPath:localIndexPath];
[self.myTableView scrollRectToVisible:cell.frame animated:YES];
- (void) keyboardWasHidden:(NSNotification *) notif
NSDictionary *info = [notif userInfo];
NSValue *value = [info objectForKey:UIKeyboardFrameBeginUserInfoKey];
CGSize keyboardSize = [value CGRectValue].size;
NSLog(@"keyboardWasHidden keyBoard:%f", keyboardSize.height);
//keyboardWasShown = NO;
self.myTableView.frame = self.view.bounds;
- (void)viewDidLoad
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSMutableArray *temp = [[NSMutableArray alloc] initWithObjects:@"111",@"222",@"333", nil];
self.array = temp;
[temp release];
temp = nil;
self.myTableView.editing = YES;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasShown:) name:UIKeyboardDidShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasHidden:) name:UIKeyboardDidHideNotification object:nil];
你的采纳是我前进的动力,还有不懂的地方,请继续追问。
以上是关于求助关于scrollToRowAtIndexPath 不执行的主要内容,如果未能解决你的问题,请参考以下文章
【求助】问一个关于UF_OBJ_cycle_objs_in_part()的简单的问题