Saturday 15 August 2015

iphone - How to abstract class names or types in Objective C to use as variables? -


I have found that many of my list controllers behave in the same way, and now I have a normal list of them named ListVC Is required when planning to make an example of ListVC, and pass it in all the specific things needed for that specific example

For example, if I need a list of customers, then I I'll do something like this:

  ListVC * customersVC = [[ListVCAbout] init]; CustomersVC.tableArray = self.customersList   

There is a time when I need to know the class type of some objects in my example, array self.customersList objects are from class CustomerClass . I know that I can do it, but when I have a method inside the list that needs to be returned to the type of object, then it does not help. For example, in LISTVICE, this old non-systemic method:

  - (customer class *) customerfafeter   

something like this should be: <<> - (self.objectClass *) objectAfterter

And I would like to set the object class as if it was done immediately.

  ListVC * customersVC = [[ListView Alok] init]; CustomersVC.tableArray = self.customersList customersVC.objectClass = [customer class class];   

How can I do something like this? Or if my view is wrong, then please suggest the correct approach. I'm starting a programming in

You can not change the return type this way. What you can do is return a id , which is an indicator for the objects of any class. Edit

  - (id) objectAfterFilter   

[CustomersVC objectsfiltersfilter]; [Cdc customer stuff];

Optionally:

  [(customer *) [customersVC objectfreaker]] doCustomerStuff];    

No comments:

Post a Comment