Thursday, May 30, 2013

UIButton reversesTitleShadowWhenHighlighted example in Objective C (iOS).

UIButton reversesTitleShadowWhenHighlighted

A Boolean value that determines whether the title shadow changes when the button is highlighted.

@property(nonatomic) BOOL reversesTitleShadowWhenHighlighted

Discussion of [UIButton reversesTitleShadowWhenHighlighted]
If YES, the shadow changes from engrave to emboss appearance when highlighted. The default value is NO.

UIButton reversesTitleShadowWhenHighlighted example.
UIButton   *randomButton = [[UIButton buttonWithType:UIButtonTypeRoundedRect ]];   
    randomButton.frame = CGRectMake(205, 145, 90, 22); // size and position of button
    [randomButton setTitle:@"Random" forState:UIControlStateNormal];
    randomButton.backgroundColor = [UIColor clearColor];
    randomButton.adjustsImageWhenHighlighted = YES;
    [randomButton addTarget:self action:@selector(getrandom:)
           forControlEvents:UIControlEventTouchUpInside];
    randomButton.reversesTitleShadowWhenHighlighted=YES;
    randomButton.toggleButton

    [self.view addSubview:randomButton];

    randomButton.tag=333;

Example of [UIButton reversesTitleShadowWhenHighlighted].
buttonPic.showsTouchWhenHighlighted = YES;
buttonPic.reversesTitleShadowWhenHighlighted = YES;

End of UIButton reversesTitleShadowWhenHighlighted example article.