parameters - typecasting to custom object - is data lost? -


i created custom uibutton object nsinteger property, assign enum value identification purposes. using .tag property else, created custom class.

i had pass custom class function accepts uibutton parameter , returns uibutton. typecast button typing this:

self.clockinbutton = (pacustombutton *)[self changebuttonimage:(pacustombutton *)self.clockinbutton withimage:@"white_square_small"]; 

when button method, lose custom buttonname property? conform uibutton or keep custom properties?

edit

fyi, im not looking solution problem. im asking informational purposes. solution (in case), write new function did same thing intended custom button instead of basic uibutton. however, if want offer alternative solutions, welcome. want make sure original question answered

you can cast object whatever want. not change true type of object is. can assign uibutton subclass regular uibutton reference, not turn subclassed button else. key thing remember here difference between pointers , objects. because pointer of type x not mean object points of type x.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -