[Mono-bugs] [Bug 570959] UISlider does not fire ValueChanged when the value is set via code

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Feb 20 13:19:04 EST 2010


http://bugzilla.novell.com/show_bug.cgi?id=570959

http://bugzilla.novell.com/show_bug.cgi?id=570959#c3


Geoff Norton <gnorton at novell.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID

--- Comment #3 from Geoff Norton <gnorton at novell.com> 2010-02-20 18:19:02 UTC ---
This appears to be a bug in the underlying obj-c implementation of UISlider.  I
wrote the following objc testcase:

@implementation SliderController

// Implement loadView to create a view hierarchy programmatically, without
using a nib.
- (void)loadView{
    [super loadView];

    CGRect frame = CGRectMake(10, 50, 300, 260);
    label = [[UILabel alloc] initWithFrame:frame];
    label.textAlignment = UITextAlignmentCenter;
    label.font = [UIFont fontWithName:@"Verdana" size:36];    
    label.text = @"10";
    [self.view addSubview:label];
    frame = CGRectMake(10, 370, 300, 10);
    slider = [[UISlider alloc] initWithFrame:frame];
    slider.minimumValue = 0.0;
    slider.maximumValue = 100.0;
    slider.continuous = NO;
    slider.value = 10.0;
    [slider addTarget:self action:@selector(updateLabel:)
forControlEvents:UIControlEventValueChanged];
    [self.view addSubview: slider];
    frame = CGRectMake(10, 10, 300, 40);
    button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    button.frame = frame;
    [button setTitle:@"Click Me" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(buttonClick:)
forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview: button];
}


- (void)buttonClick: (id) sender {
    slider.value = 80.0;
}

- (void)updateLabel: (id) sender {
    label.text = [NSString stringWithFormat:@"%f", slider.value];
}

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}


@end


Pushing the button causes the slider to move, but does NOT cause the label to
be updated, just like in MonoTouch.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list