如何在iPhone中的UIPinchGesture中设置放大后uiscrollview的内容大小
我必须在 iphone 中实现 UIPinchGesture
,我的代码如下:
- (void)handlePinch:(UIPinchGestureRecognizer*)recognizer
{
if ( [recognizer state] == UIGestureRecognizerStateBegan ||
[recognizer state] == UIGestureRecognizerStateChanged )
{
NSLog(@"=======Scale Applied===========");
if ( [recognizer scale]<1.0f )
{
[recognizer setScale:1.0f];
}
CGAffineTransform transform = CGAffineTransformMakeScale([recognizer scale], [recognizer scale]);
self.view.transform = transform;
}
这段代码对于放大和缩小工作正常,但是当我放大时,我无法 滚动视图,以便我可以阅读视图上的文本。
谢谢。
I have to implement UIPinchGesture
in iphone for that my code as follows:
- (void)handlePinch:(UIPinchGestureRecognizer*)recognizer
{
if ( [recognizer state] == UIGestureRecognizerStateBegan ||
[recognizer state] == UIGestureRecognizerStateChanged )
{
NSLog(@"=======Scale Applied===========");
if ( [recognizer scale]<1.0f )
{
[recognizer setScale:1.0f];
}
CGAffineTransform transform = CGAffineTransformMakeScale([recognizer scale], [recognizer scale]);
self.view.transform = transform;
}
This code is working fine for zooming in and zooming out but when i zoom in i am not able to
scroll the view so that i can read the text on the view.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须使用
UIScrollView
而不是UIView
。完成此操作后,您必须调整滚动视图的内容大小。如果内容大于屏幕,则滚动视图会自动滚动。
希望有帮助。
You have to use a
UIScrollView
instead yourUIView
. Once you have done this, you have to resize the content size of your scroll view.if the content is bigger than the screen the scrollview is automatically scrollable.
Hope it helps.