iOS中常用小东西

来源:互联网 发布:mac外服加速器 编辑:程序博客网 时间:2024/05/17 08:45

1.右滑返回

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
        self.navigationController.interactivePopGestureRecognizer.enabled = YES;
        // 手势有效设置为YES  无效为NO
        self.navigationController.interactivePopGestureRecognizer.delegate = self;
        // 手势的代理设置为self

}

2.禁用第三方键盘

- (BOOL)application:(UIApplication *)application shouldAllowExtensionPointIdentifier:(NSString *)extensionPointIdentifier

{
    
    if ([extensionPointIdentifier isEqualToString:@"com.apple.keyboard-service"]) {
        
        return NO;
        
    }
    
    return YES;
    
}

3.改变状态栏颜色

[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;

4.画下划线

NSMutableAttributedString *attributedStr = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"点击注册表示已阅读并同意用户服务使用条例"]];
    NSDictionary *dic = @{NSUnderlineStyleAttributeName:[NSNumber numberWithInteger:NSUnderlineStyleSingle]};
    [attributedStr addAttributes:dic range:NSMakeRange(12,8)];
    label1.attributedText = attributedStr;
    label1.textColor = [UIColor whiteColor];
    label1.font = [UIFont systemFontOfSize:14];
    label1.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:label1];

中间划线,也是相同道理。

0 0