Calling an instance method from another class

Consider this view setup:

alt text

I have a view controller that switches between a set of sub-views. Each subview is a subclass of UIView with custom code. To switch views, I use the switch statement, which selects the new view as the current one. It works very well.

Now I am in a position where I have a view (MainMenu) with an additional view (PopUp) that contains a UITableView. The PopUp view is shown and hidden using instance methods of the MainMenu.h class. Lets you call the showPopUp and hidePopUp methods.

When a user selects an item from a UITableView, they must manually close the view (PopUp) by clicking the close button associated with the hidePopUp method.

, UITableView, , hidePopUp .

instance hidePopUp didSelectRowAtIndexPath UITAbleView? NSNotificationCenter? ,

[[[UIApplication sharedApplication] delegate] closePopUp]; 

didSelectRowAtIndexPath ...

, , , - , . !

+3
1

, , , ( singleton [anti] ). .

- :

@protocol PopUpDelegate
@optional
- (void)Popup:(YourPopUpClass *)popUp didEndWithData:(NSData *)blah;
@end

MainMenu, Popup, Popup .

, , : Objective-C?

+1

Source: https://habr.com/ru/post/1777352/


All Articles