Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiple Custom Buttons, Only One Displayed Correctlly
    primarykey
    data
    text
    <p>I'm trying to use some custom buttons on the iOS device. And here is what I did: I added a <code>UIButton</code> on Storyboard and changed its type to <code>Custom</code>. After that, I changed the default button image under the "Attributes Inspector" tab. Then I used the following two lines of code to set the status of the button:</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; [self.button1 setImage:[UIImage imageNamed:@"unclicked.png"] forState:UIControlStateNormal]; [self.button1 setImage:[UIImage imageNamed:@"clicked.png"] forState:UIControlStateHighlighted]; } </code></pre> <p>This behaves perfectly on the simulator. Thus I copied this button on storyboard and paste another two. For sure, I removed their reference to <code>button1</code> and refer them to another two newly created <code>UIButton</code> outlet in the view controller header file and synthesize them in the .m file. And I append the following lines to the above code:</p> <pre><code> ... [self.button2 setImage:[UIImage imageNamed:@"unclicked.png"] forState:UIControlStateNormal]; [self.button2 setImage:[UIImage imageNamed:@"clicked.png"] forState:UIControlStateHighlighted]; [self.button3 setImage:[UIImage imageNamed:@"unclicked.png"] forState:UIControlStateNormal]; [self.button3 setImage:[UIImage imageNamed:@"clicked.png"] forState:UIControlStateHighlighted]; ... </code></pre> <p>Everything seems normal on the <code>Storyboard</code>. But after I ran the simulator, only the image of <code>button3</code> can be displayed correctly. The other two disappeared and showing something like <code>c..</code> only. How could I make the three buttons behave correctly? I tried hard but made no progress. Could somebody help me? Thank you so much.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload