开发中的小设置

2016-11-05  本文已影响30人  ibiaoma

1、将系统提示文字改为中文

很多情况下,双击UITextField系统会默认弹出Paste,copy等,还有打开相机、相册之后系统的Cancel 、Cammera等
如果想要设置成中文的话:

解决方法:

在Info.plist中添加两个属性即可

Localization native development region           China 

Localized resources can be mixed                 Yes

2、添加长按手势时,长按的方法会执行两次

解决方法:
    UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(longPressToSavePhoto:)];
    longPress.minimumPressDuration = 0.8;
    longPress.numberOfTouchesRequired = 1;
    [self addGestureRecognizer:longPress];

- (void)longPressToSavePhoto:(UILongPressGestureRecognizer *)longPress{
if (longPress.state == UIGestureRecognizerStateBegan) {
    UIActionSheet *action = [[UIActionSheet alloc]initWithTitle:@"保存图片" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"保存", nil];
    UIWindow *window = [UIApplication sharedApplication].keyWindow;
    [action showInView:window];
}else{
}

}

上一篇下一篇

猜你喜欢

热点阅读