The IBAction function of buttons placed in custom cells is not called.

Asked 2 years ago, Updated 2 years ago, 34 views

·What you want to do
 I want to process (replace images) when buttons placed in custom cells are pressed.

·Problems
 Pressing the button does not call the action function linked by IBAction.

·Prepare files such as CustomCell.xib/CustomCell.swift.
 Place a button in CustomCell.xib and click
 IBAction functions are described in CustomCell.swift.
·If you look at it in the inspector, it is properly linked.
·CustomCell.xib is owned by CustomCell.swift.

"You should check here," "You should change it to this kind of process," etc.
If you have any advice, please let me know.
Thank you in advance.

swift ios

2022-09-30 19:27

1 Answers

As you can see in the comment section, the current status of the questionnaire says, "Well, you should be able to do that.If you actually try it, it's done." All you'll get is a response.With that kind of content, you can't answer, so you have no choice but to say that you can't answer.
I was also able to create an Xcode project based on the information on the Internet (the result of searching by keywords such as "xib tableviewcell"), tap the button on the cell, and run the method set to IBAction.In fact, however, the results were not achieved without any particular difficulties.It is true that I followed the procedure on the site, but the result was that I did not respond even if I pressed the button.
Among the information on the Internet, success stories are as follows:
That is how to make XIB files.Instead of creating an XIB file directly from the File menu in Xcode, New, create an XIB file as an option to create a Cocoa touch class file.(See the picture below, check the Also create XIB file and create a new class file.)

Enter a description of the image here

In this way, creating an XIB file saves the XIB configuration in a preset state, preventing misconfiguration and forgetting to configure it.


2022-09-30 19:27

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.