English 中文(简体)
页: 1 图表
原标题:iOS Scrollview detect Scrolling

我阅读了以往所有关于这一准确专题的员额,但当用户在这种iPad的估算中不断发展时,我仍然无法发现。

My .h:

#import <UIKit/UIKit.h>

@interface MyApp_ViewController : UIViewController <UIScrollViewDelegate>
{

}
@property (weak, nonatomic) IBOutlet UIButton *otherButton;
@property (weak, nonatomic) IBOutlet UIScrollView *otherScrollView;
@property (weak, nonatomic) IBOutlet UITextView *txtViewHTML;

-(void)k_RootViewPrint:(NSString *) data;

-(void)ActionEventForButton: (id) sender;

@end

my .m:

-(void)scrollViewDidScroll:(UIScrollView *)scrollView 
{

    NSLog(@"...");
}

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
    NSLog(@"2222");
}
- (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event 
{
    NSLog(@"touches ended BS");
}

但它们都没有工作? 我确信这只是一个简单的问题,但我已尽了一切可能,而且仍然无所作为。 对正确方向的任何指导都将受到高度赞赏。

最佳回答

您是否向您提出意见书。

问题回答

如果不在<条码>中进行伐木:,则该滚动观点代表不交给观察控制员。

You can check this in the debugger. After your app has launched, pause in the debugger and run this command:

po [[(id)UIApp keyWindow] recursiveDescription]

看看你UIScrollView的讲话。 将有一个行文,如<代码><UIScrollView:0xc894d60......>。 以我为例,请地址(0xc894d60),并在这一错误的指挥中使用:

po [0xc894d60 delegate]

如果它印刷了诸如<代码><MyApp_ViewController:0x6a7f6c0>等内容,则贵国代表的顺序是正确的。 如果它印刷“Can t 印刷了NNIL物体的描述”,那么你就没有确定滚动观点代表。 如果它印刷了其他东西,那么你就会错误地把滚动观点放在一边。

对于像我这样可能遭受损失的其他人,这里的解决办法是:

- (void)viewDidLoad
{
[super viewDidLoad];
self.otherScrollView.delegate = self; // This is the KEY

检查你是否设立了代表,然后尝试

1. 执行`

- (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event 
{   
    // If not dragging, send event to next responder
    if (!self.dragging) 
        [self.nextResponder touchesEnded: touches withEvent:event]; 
    else
        [super touchesEnded: touches withEvent: event];
}
`




相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签