隐藏/去掉导航栏返回按钮文字
// 方法一
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60) forBarMetrics:UIBarMetricsDefault];
// 方法二 - 注意此法需要在前一界面内设置
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@""
style:UIBarButtonItemStylePlain
target:self
action:nil];
http://stackoverflow.com/questions/19078995/removing-the-title-text-of-an-ios-7-uibarbuttonitem
键盘可能遮挡输入框时的视图上移
// SSJLogin.m
/** 在UITextField编辑之前调用方法 **/
- (void)textFieldDidBeginEditing:(UITextField *)textField {
// 视图上移
[SSJGeneralTool animationOfTextField:textField isUp:YES withDistance:TEXTFIELD_MOVEDISTANCE inView:self.view];
}
/** 在UITextField编辑完成调用方法 **/
- (void)textFieldDidEndEditing:(UITextField *)textField {
// 视图下移
[SSJGeneralTool animationOfTextField:textField isUp:NO withDistance:TEXTFIELD_MOVEDISTANCE inView:self.view];
}
// SSJGeneralTool.m
+ (void)animationOfTextField:(UITextField *)textField isUp:(BOOL)up withDistance:(NSInteger)distance inView:(UIView *)view {
// 设置视图实际上移距离
NSInteger moveDistance = (up ? -distance : distance );
[UIView beginAnimations:@"Animation" context:nil];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:0.20];
view.frame = CGRectOffset(view.frame, 0, moveDistance);
[UIView commitAnimations];
}
提示:此处考虑项目通用需求,将视图移动作为通用类方法,所以根据你的需求,也可以直接写在应用此方法的文件,比如像此处的
SSJLogin.m
。