Editing a tag with an iOS tag

I searched this everywhere and I cannot find a solution ...

My goal: I'm trying to edit a shortcut in my storyboard without creating an output specifically for this tag (I have 36 shortcuts).

Problem: I tried this main line of code, which I found in another question, but it failed and I got an error ...

UILabel *label = (UILabel *)[self viewWithTag:71];

Error: No visible @interface for 'ViewControllerTwo' declares the selector 'viewWithTag:'

Any help would be appreciated ...

+3
source share
3 answers

Change your code to

                                    |
                                    v
UILabel *label = (UILabel *)[self.view viewWithTag:71];

UIViewControllerIt has not viewWithTag:, UIViewdoes

+9
source

viewwithTag is a UIView method, not a UIViewController. You may have to call it this way:

UILabel *label = (UILabel *)[self.view viewWithTag:71];
+4
source

self.view:

UILabel *label = (UILabel *)[self.view viewWithTag:71];
+1

All Articles