I have given my self a crash course in iphone dev over the last 2-3 weeks, so im still finding my feet with objective-c.
I have a small project where i read in data from an XML off the internet. One of the parameters is an <email></email> email address. What i would like to do is send the value of this <email></email> tag to the UIButton selector, so from there i can open the mail client on the phone and send an email.
Each UIButton is programatically in a for loop because there are going to be multiple instances of the <email></email>. I would like to send a NSString, the contents of the <email></email> tag, as an argument to the @selector. I am aware of comparing the title and im also aware of the tag but i dont think i can use these as the title of the buttons will always be "email" and the tag is an integer.
I would be grateful if someone could point me in the right direction.
Thanks for your reply. Im not quite sure how to subclass UIButton, but i can certainly implement the array approach. In your opinion which would be the best approach?
Your ButtonWithEmail now is normall UIButton controll with additional NSString property, where you can store your content. Don't forget to release it in dealloc.
__________________ Get the most Recent Photos of your friends!
The problem is you are creating button using factory method buttonWithType. In your subclass you don't override it and it is invoked on super: UIButton. UIButton buttonWithType returns new UIButton object but NOT your extended subclass object. All works when you are creating button by:
In my case in past it was ok, cause i had custom buttons with image in my project. Problem is that after init you can't set button style because this property is read-only in UIButton.
I think in this case easier way will be my first idea with array
__________________ Get the most Recent Photos of your friends!
Ahhh ok that makes sense. However, i have started down this road so im going to try and follow it through
I have amended my code and the app does not crash, but there is no button being create (visibly at least). Please could you explain how i would go about creating the custom buttons so it get displayed on my app?