zoukankan      html  css  js  c++  java
  • 2015/10/2 iOS笔记 细节

    网页如何跳转到想要的位置

    <!DOCTYPE html>

    <html>

        <head>

            <title>

            <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />

            <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">

                <meta name="format-detection" content="telephone=no">

                    <link rel="stylesheet" type="text/css" href="rule.css">

                    <script>

                        function btnClick()

                        {

                            window.location.href = "#howtorecharge";

                        }

                    </script>

                    

        </head>

        <body>

            <input type="button" value = "按钮baby" onClick = "btnClick()">

            <div>

    一、按钮不能交互的几种情况

    1,alpha <= 0.01 (0.02就能点了)

    2,hidden = YES

    3, userInteraction = NO

    4, 所在的父视图不允许交互,按钮也不能交互

    5,在父视图可见范围内可以交互,超出范围的部分不能交互。

    二、UIImageView 默认 不允许用户交互的。

    三、乱序

    - (void)randomOptions

    {

        // 对option数组乱序

        [self.options sortedArrayUsingComparator:^NSComparisonResult(NSString *str1, NSString *str2) {

            

            int seed = arc4random_uniform(2);

            

            if (seed) {

                return [str1 compare:str2];

            } else {

                return [str2 compare:str1];

            }

            

        }];

    }

    四、模型内进行乱序,只在加载的时候做一次乱序。

    - (instancetype)initWithDict:(NSDictionary *)dict

    {

        if (self = [super init]) {

            [self setValuesForKeysWithDictionary:dict];

            

            // 对备选按钮进行乱序,只在加载的时候做一次乱序

            [self randomOptions];

        }

        return self;

    }

        在模型外进行乱序,每次调用都会进行一次乱序。

    //    [question randomOptions];

    五、添加蒙版

    - (UIButton *)cover

    {

        if (_cover == nil) {

            // 添加蒙版(遮罩)

            _cover = [[UIButton alloc] initWithFrame:self.view.bounds];

            

            _cover.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.5];

            

            [self.view addSubview:_cover];

            

            [_cover addTarget:self action:@selector(bigImage:) forControlEvents:UIControlEventTouchUpInside];

        }

        

        return _cover;

    }

    //    // 添加蒙版(遮罩)

    //    UIButton *cover = [[UIButton alloc] initWithFrame:self.view.bounds];

    //    

    //    cover.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.5];

    //    

    //    [self.view addSubview:cover];

    //    

    //    [cover addTarget:self action:@selector(smallImage:) forControlEvents:UIControlEventTouchUpInside];

        

    }

    将图像弄到蒙版前面

            // bringSubviewToFront 将子视图前置

            [self.view bringSubviewToFront:self.iconButton];

    设置蒙版的模糊程度

    self.cover.alpha = 0.0;

     self.cover.alpha = 1.0;

    六、更改状态栏的颜色

    /**

     *  调整状态栏颜色

     UIStatusBarStyleDefault                                     = 0, // Dark content, for use on light backgrounds

     UIStatusBarStyleLightContent     NS_ENUM_AVAILABLE_IOS(7_0) = 1, // Light content, for use on dark backgrounds

     */

    - (UIStatusBarStyle)preferredStatusBarStyle

    {

        return UIStatusBarStyleLightContent;

    }

    七,等待一段时间进入 一个方法

    [self performSelector:@selector(nextQuestion:) withObject:nil afterDelay:0.5];

    八、textField 设置字数限制

    - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string

    {

        int loc = range.location;

        

        return (loc < 6);

    }

  • 相关阅读:
    Response.Redirect 打开新窗体的两种方法
    linux下coredump的产生及调试方法
    AlertDialog具体解释
    数据仓库与数据挖掘的一些基本概念
    JS中setTimeout()的使用方法具体解释
    iOS开发- 查询项目代码行数
    STM32学习之路-LCD(3)&lt;显示图片&gt;
    谷歌技术&quot;三宝&quot;之MapReduce
    [ffmpeg 扩展第三方库编译系列] 关于libvpx mingw32编译问题
    javascript笔记
  • 原文地址:https://www.cnblogs.com/pjl0426/p/4852984.html
Copyright © 2011-2022 走看看