WebView无法禁用滚动,但保留PDF中的链接和按钮

时间:2015-08-10 15:17:26

标签: ios objective-c scroll uiwebview

想要禁用PDF中的滚动,但保留PDF中的链接和按钮。已经尝试了其他线程的解决方案,但没有一个对我有用:

Field[] fields = R.string.class.getFields();
int size = fields.length; // If you want the size.
for (Field field : fields) {
    String str_key = field.getName();
    try {
        int id = field.getInt(null);
        String str_value = getString(id);
        // Store the String, and do whatever you want with it.

        Log.d("TAG","Key: " + str_key + " value: " + str_value);
    } catch (IllegalAccessException e) {
        Log.e("TAG",e.getMessage());
        e.printStackTrace();
    }
}

都不是,

webView.scrollView.scrollEnabled = NO; 
webView.scrollView.bounces = NO;

不,

[[_Presentation scrollView] setScrollEnabled:NO];
[[_Presentation scrollView] setBounces:NO];

1 个答案:

答案 0 :(得分:1)

我终于解决了这个问题。以下是步骤:

在.h文件中添加UIScrollViewDelegate:

class a {
    public static int var;
    private int getVar() {
        return var; //Yes
    }
    private void setVar(int var) {
        a.var = var; //Yes
    }
}


class b {
    private int getVar() {
        return a.var; //Yes
    }
    private void setVar(int var) {
        a.var = var; //No
    }
}

在.m文件中,ViewController - > viewDidLoad添加以下行来接管ScrollView Delegate

@interface ViewController : UIViewController  <UIScrollViewDelegate>

在.m文件中,在viewDidLoad:

下面添加以下滚动事件
_Presentation.scrollView.delegate = self;