ScrollView blocking NavigationViewController

时光总嘲笑我的痴心妄想 提交于 2019-12-12 03:27:51

问题


I have a UIView with a UINavigation controller and several other Imageviews and a text filed inside it. On the Navigation bar there is a UIBarbutton item which pushes another ViewController.

When the text field in the Navigation Viewcontroller is tapped it brings up the keyboard causing the textfield to be blocked by the keyboard.I want to enable scroll view whenever the keyboard blocks the textfield.

A notification is sent to this method whenever the keyboard is invoked.

- (void)displayKeyboard {

scroll=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
scroll.contentSize=CGSizeMake(0, 500);
scroll.userInteractionEnabled=YES;
[self.view addSubview:scroll];

} 

I tried to programmatically add a scrollview onto the view but this causes the entire view to be blocked.I can see the scroller but it does not anything and i cant access the view anymore.

Am i doing something wrong ?

Is there any other way i can enable the scroll view whenever the keyboard appears so i can scoll the entire screen ?

来源:https://stackoverflow.com/questions/14819262/scrollview-blocking-navigationviewcontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!