【发布时间】:2012-01-22 10:47:10
【问题描述】:
我有两个视图控制器。一个用于页面控制的滚动视图和一个用于详细信息的滚动视图(垂直滚动)。
当我在 iPhone 上单击状态栏时,scrollToTop 不起作用,而在 iPad 中,scrollToTop 正在工作。
我确定 scrollView.scrollToTop 是 YES。因为我已经打印出来了。
谁知道是什么原因导致 iPhone 的 scrollToTop 不工作?
谢谢
编辑: 我尝试调用 scrollView 委托。 在 iPad 中,这个委托被称为。 - (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView
在 iPhone 中它不被调用。 我已经同时使用了 contentScrollView.delegate = self; 但是iphone不工作:(
编辑:尝试子类化 UIWindow(不工作)
窗口.h
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
@interface Window : UIWindow
@end
窗口.m
#import "Window.h"
@implementation Window
- (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
if ([event type] == UIEventTypeTouches && point.y < 250) {
//Send Your Notification Here
NSLog(@"KAROOO");
}
NSLog(@"HELLOWW");
return [super hitTest:point withEvent:event];
}
@end
AppDelegate.h
@property (nonatomic, strong) IBOutlet Window *window;
AppDelegate.m
@synthesize window = _window;
【问题讨论】:
标签: iphone objective-c uiscrollview