Created
December 1, 2011 23:09
-
-
Save projectxcappe/1420583 to your computer and use it in GitHub Desktop.
addTarget to another class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//BCWebAdView.m | |
-(void)testmethod:(id)sender{ | |
NSLog(@"testmethod"); | |
} | |
//-----------// | |
//TLAdView.m | |
#import "TLAdView.h" | |
#import "BCWebAdView.h" | |
#import "TLUtil.h" | |
#import "BCWebAdView.h" | |
@implementation TLAdView | |
@synthesize adView; | |
@synthesize adButton; | |
@synthesize delegate; | |
BCWebAdView *instanceOfBCWebAdView; | |
//----- | |
-(void)createButtonTLAdView { | |
NSLog(@"createButtonTLAdView"); | |
self.adButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; | |
[adButton setFrame:CGRectMake(0.0f, 0.0f, 320.0f, 50.0f)]; | |
adButton.backgroundColor = [UIColor greenColor]; | |
adButton.opaque = YES; | |
[self.adButton setUserInteractionEnabled:YES]; | |
[adButton addTarget:instanceOfBCWebAdView action:@selector(testmethod:) forControlEvents:UIControlEventTouchUpInside]; | |
NSLog(@"thisbutton %@", adButton); | |
[self addSubview:adButton]; | |
[self.adButton setNeedsDisplay]; | |
[self setNeedsDisplay]; | |
[self subviews]; | |
} | |
//---------// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment