One way is to pass parameters in the set selector method.

I find it more OO to create a new object which derive from UIButton, and add the button needed properties to it.

Example:

//
//  MenuButton.h
//  Trivia
//
//  Created by Eylon Steiner on 1/23/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface MenuButton : UIButton {
int customVal;
}

@property int customVal;

@end

//
//  MenuButton.m
//  Trivia
//
//  Created by Eylon Steiner on 1/23/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import “MenuButton.h”

@implementation MenuButton

@synthesize customVal;

@end
—–

Set it like:

a1 = [MenuButton buttonWithType:UIButtonTypeCustom];
[a1 setCustomVal:cnt];

And use it like:

- (void)networkAdminButtonPressed:(UIButton *)button {
DebugLog (@”button : %d”, [(MenuButton*) button customVal]);

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2011 W2OM - iPhone by code Suffusion theme by Sayontan Sinha