我正在创建NSDate对象,我有一个导航栏,我试图保持在屏幕顶部的静态位置。 我希望在导航栏下方创建NSDate对象,但是它们正在导航栏上方创建并向下推导航栏。如何限制导航栏,并防止它移动
这是我insertNewObject功能
- (void)insertNewObject
{
if (!_objects) {
_objects = [[NSMutableArray alloc] init];
}
[_objects insertObject:[NSDate date] atIndex:0];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
[self.tableView insertRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
}
我怀疑它有这个功能,调用insertNewObject方法来做。具体来说,我相信自我调用意味着它告诉它在ViewController的顶部创建它。
- (IBAction)addData:(id)sender {
// call insertNewObject
[self insertNewObject];
}
如何约束我的导航栏并防止在导航栏上创建新的NSDate对象?