Thursday, September 26, 2013

UIScrollView button above to create a lot of problems not smooth scrolling

Now need to fit on one screen showing many buttons, currently my approach is to create a UIView inside a UIScrollView, and then in the UIScrollView created above these buttons.
Button is to show up, but when scrolling UIScrollView not so smooth: finger sliding, it often is the point to the button, causing the UIScrollView scrolling is not smooth.
Prawn Support Weapon, see what better way can scroll UIScrollView, it does not trigger button pressing operation. When you press the button, the button response of the others still exist.
ViewController's viewDidLoad which controls to create the code below:
 UIScrollView * view = [[UIScrollView alloc] initWithFrame: CGRectMake (0, 0, 320, 480)]; 
[View setUserInteractionEnabled: YES];
[View setScrollEnabled: YES];
/ / [View setContentSize: CGSizeMake (800,800)];

/ / NO notifications sent rolling movement of the finger scroll, but even if it does not move YES to send the notification scroo can move
[View setCanCancelContentTouches: YES];
[View setBounces: NO];
/ / NO immediately notify touchesShouldBegin: withEvent: inContentView see if scrolling scroll
[View setDelaysContentTouches: NO];
[View setContentSize: CGSizeMake (300, 900)];
[Self.view addSubview: view];


CGFloat yPlacement = 50;
for (int i = 0; i <30; + + i)
{
CGRect frame = CGRectMake (20, yPlacement, self.view.bounds.size.width - (20 * 2.0), 40);
UIButton * btn = [UIButton buttonWithType: UIButtonTypeRoundedRect];
btn.frame = frame;
/ / Set the text under normal circumstances Button (UIControlStateNormal | UIControlStateHighlighted ...)
[Btn setTitle: @ "UIButtonTypeRoundedRect" forState: UIControlStateNormal];
/ / Set the Button Click Event, UIControlEventTouchDown like Click
/ / [Btn addTarget: self action: @ selector (numBtnClick :) forControlEvents: UIControlEventTouchDown];
[View addSubview: btn];

yPlacement = yPlacement + 40 + 10;
}

[View release];

Reply:
Why do not TABLEVIEW
Reply:
Tableview effect can be made into a button? This effect require a button, rather than a simple entry.
Reply:
If the relevant agreements in UIScrollView method set the button userinteractionenable, scroll beginning to No, the end of the set rolling Yes, I wonder if this is feasible
Reply:
 - (void) scrollViewWillBeginDecelerating: (UIScrollView *) scrollView {
NSLog (@ "decelering ...");
}

- (Void) scrollViewDidEndDecelerating: (UIScrollView *) scrollView {
NSLog (@ "deceler end ...");
}


These two agents in the above methods, the right button to enable the operation

No comments:

Post a Comment