Im very new to objective c and iOS. This is my first app ever so bear with me.
Im just trying to make a page with some buttons that are dynmically created from a text file, that will open a page in webview.
I'm basing my code off this: how can i pass any kind of parameter in UiButton action?
MyButton.h
#import <Foundation/Foundation.h>
@interface MyButton : UIButton
{
NSString *_linkURL;
}
@property (nonatomic, retain) NSString *linkURL;
@end
MyButton.m
#import "MyButton.h"
@implementation MyButton
@synthesize linkURL = _linkURL;
@end
So then in my ViewController.m file I'm importing MyButton and trying to use it to create buttons that have the URL as their own property.
MyButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchDown];
[button setLinkURL:URL]; //THIS IS THE LINE THATS GIVING ME THE unrecognized selector at instance error
Then I go on to get the URL in the buttonPressed method but I cant seem to get past this one error. I have no idea what Im doing wrong.