export卡住 ios
2016-03-11 15:31:00 weixin_30378311 阅读数 1

interactivePopGestureRecognizer是iOS7推出的解决VeiwController滑动后退的新功能,虽然很实用,但是坑也很多啊,用过的同学肯定知道问题在哪里,所以具体问题我就不描述了,这里只给出如何完美解决interactivePopGestureRecognizer卡住的问题.

当然我们要自定义UINavigationController来解决这个问题:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101

#import "MMNavController.h"


@interface MMNavController ()
{

}

@end

@implementation MMNavController

- (id)initWithRootViewController:(UIViewController *)rootViewController
{
self = [super initWithRootViewController:rootViewController];
if (self) {
// Custom initialization

}
return self;
}


- (void)viewDidLoad
{

__weak MMNavController *weakSelf = self;

if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)])
{
self.interactivePopGestureRecognizer.delegate = weakSelf;

self.delegate = weakSelf;
}

}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{

if ( [self respondsToSelector:@selector(interactivePopGestureRecognizer)] && animated == YES )
{
self.interactivePopGestureRecognizer.enabled = NO;
}

[super pushViewController:viewController animated:animated];

}

- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated
{
if ( [self respondsToSelector:@selector(interactivePopGestureRecognizer)] && animated == YES )
{
self.interactivePopGestureRecognizer.enabled = NO;
}

return [super popToRootViewControllerAnimated:animated];

}

- (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated
{
if( [self respondsToSelector:@selector(interactivePopGestureRecognizer)] )
{
self.interactivePopGestureRecognizer.enabled = NO;
}

return [super popToViewController:viewController animated:animated];

}

#pragma mark UINavigationControllerDelegate

- (void)navigationController:(UINavigationController *)navigationController
didShowViewController:(UIViewController *)viewController
animated:(BOOL)animate
{
if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)])
{
self.interactivePopGestureRecognizer.enabled = YES;
}
}


-(BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{

if ( gestureRecognizer == self.interactivePopGestureRecognizer )
{
if ( self.viewControllers.count < 2 || self.visibleViewController == [self.viewControllers objectAtIndex:0] )
{
return NO;
}
}

return YES;
}
@end

转载于:https://www.cnblogs.com/jgCho/p/5265928.html

2019-06-28 19:40:11 simper_boy 阅读数 50

直接贴代码跟图,等会再解释

在这里插入图片描述
左边页面是滚动的,.container元素包含需要滚动的内容,关键代码是给container加上

position:static
overflow: auto;
-webkit-overflow-scrolling: touch;//主要用来设置在IOS浏览器的容器内滚动是否开启惯性和回弹的,有两
									//个值touch和auto;
									//touch表示手指从触屏离开的时候有一个回弹,不会马上停止
									//auto表示手指从触屏离开马上停止滚动。

(注:container如果是在正常文档流下,则不用添加position:static)
一般加上是可以滚动了,但是会出现卡住的情况,下面是解决办法
在这里插入图片描述
在container下加一个子元素来包裹里面滚动的元素

<div style="min-height: 101%"></div>
style="min-height: 101%"//这个是重点!!!!!

好了到此就解决啦,欢快
笔者给这个ios页面卡屏的问题整了一天 :)

2016-03-11 15:31:00 weixin_34253539 阅读数 2

interactivePopGestureRecognizer是iOS7推出的解决VeiwController滑动后退的新功能,虽然很实用,但是坑也很多啊,用过的同学肯定知道问题在哪里,所以具体问题我就不描述了,这里只给出如何完美解决interactivePopGestureRecognizer卡住的问题.

当然我们要自定义UINavigationController来解决这个问题:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101

#import "MMNavController.h"


@interface MMNavController ()
{

}

@end

@implementation MMNavController

- (id)initWithRootViewController:(UIViewController *)rootViewController
{
self = [super initWithRootViewController:rootViewController];
if (self) {
// Custom initialization

}
return self;
}


- (void)viewDidLoad
{

__weak MMNavController *weakSelf = self;

if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)])
{
self.interactivePopGestureRecognizer.delegate = weakSelf;

self.delegate = weakSelf;
}

}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{

if ( [self respondsToSelector:@selector(interactivePopGestureRecognizer)] && animated == YES )
{
self.interactivePopGestureRecognizer.enabled = NO;
}

[super pushViewController:viewController animated:animated];

}

- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated
{
if ( [self respondsToSelector:@selector(interactivePopGestureRecognizer)] && animated == YES )
{
self.interactivePopGestureRecognizer.enabled = NO;
}

return [super popToRootViewControllerAnimated:animated];

}

- (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated
{
if( [self respondsToSelector:@selector(interactivePopGestureRecognizer)] )
{
self.interactivePopGestureRecognizer.enabled = NO;
}

return [super popToViewController:viewController animated:animated];

}

#pragma mark UINavigationControllerDelegate

- (void)navigationController:(UINavigationController *)navigationController
didShowViewController:(UIViewController *)viewController
animated:(BOOL)animate
{
if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)])
{
self.interactivePopGestureRecognizer.enabled = YES;
}
}


-(BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{

if ( gestureRecognizer == self.interactivePopGestureRecognizer )
{
if ( self.viewControllers.count < 2 || self.visibleViewController == [self.viewControllers objectAtIndex:0] )
{
return NO;
}
}

return YES;
}
@end

转载于:https://www.cnblogs.com/jgCho/p/5265928.html

2016-03-07 13:25:49 fanhaofei1234 阅读数 1154

第一步:在你的navigationController的viewDidLoad方法里面:

- (void)viewDidLoad {
    [super viewDidLoad];

   self.interactivePopGestureRecognizer.delegate = self;
}


第二步:

- ( BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
    
    if ( gestureRecognizer == self.interactivePopGestureRecognizer )
    {
        if ( self.visibleViewController == [self.viewControllers objectAtIndex:0] )//让第一个子控制器侧滑时不产生作用
        {
            return NO;
        }
    }
    
    return YES;
}

2017-10-18 10:13:33 lvlemo 阅读数 493

1.引入文件popup.css, popup.js

//方式1
//popup.js
//导出常量
export const kwidth = 200;
//导出函数
export function noticeHide() {
    document.getElementById("popup-backdrop").style.display = "none";
    document.getElementById("noticePopup").style.display = "none";
}
//chat.vue
import {noticeHide} from './popup.js';
//方式2
//popup.js
/**
 * 消息警告框
 * @param {提示对话框上显示的内容} message
 * @param {提示对话框上显示的标题} title
 * @param {提示对话框上按钮显示的内容} buttonCapture
 */
var notice = function(message,title,buttonCapture) {}
export {notice}
//chat.vue
import {notice} from './popup.js';

2.1.popup.js

export {prompts,notice,confirms,noticeHide,isConfirm_confirm}

2.2chat.vue

<el-button type="primary" class="btn" @click="submitAction()">提交</el-button>
<script>

    import {prompts,notice,confirms,noticeHide,isConfirm_confirm} from '../Common/Alert/popup.js'

    export default {

        data:function(){
          return {
              textarea:''
          }
        },

        methods:{

            backAction: function(){
                this.$router.back();
            },
          //提交按钮点击事件
            submitAction:function(){

               var self = this;
               if(self.textarea ==''){
                   confirms("请填写内容",'提示');

                  //点击'是'触发事件,隐藏提示框
                   document.getElementById("confirmY").onclick = function(){

                       isConfirm_confirm();
                   }

                   //点击'否'触发事件,隐藏提示框,back返回当前界面
                   document.getElementById("confirmX").onclick = function(){

                       isConfirm_confirm();
                       self.backAction()
                   }

                }else{
                   notice('提交成功','提示','OK');
                   var self = this
                   //点击'OK'触发事件,隐藏提示框,back返回当前界面
                   document.getElementById("notice").onclick = function(){
                       noticeHide()
                       self.backAction()
                   }
                }
            }
        }
    }
</script>
<style>
@import "../Common/Alert/pop.css"
</style>

没有更多推荐了,返回首页