Tommy B.
Tommy B.

Reputation: 3639

Guide about subclassing

I'd like to create a subclass of UIAlertView to implement my own defaut behaviors when users click on the dialog's buttons.

It would be awesome if someone would guide me through it or just point me to some guide about subclassing?

Thanks!

Upvotes: 1

Views: 104

Answers (2)

Kris Markel
Kris Markel

Reputation: 12112

You most likely don't want to subclass UIAlertView. Rather you want to implement the UIAlertViewDelegate protocol on your view controller. This will allow you to customize what happens when a user clicks a button on the alert view.

Some some examples, check out any of the sample projects listed under "Related sample code" at the protocol documentation that I've linked to above.

Upvotes: 2

Henrik P. Hessel
Henrik P. Hessel

Reputation: 36617

There is not much to say about subclassing in Objective C.

The standard syntax looks like this.

@interface NSObjectSubClassedObject : NSObject {

}

Two things to mention: Multi-Inheritance is not supported and there's another method to "subclass" certain objects called Categories.

Upvotes: 1

Related Questions