Skip to content

Instantly share code, notes, and snippets.

@projectxcappe
Created December 1, 2011 19:22
Show Gist options
  • Save projectxcappe/1419147 to your computer and use it in GitHub Desktop.
Save projectxcappe/1419147 to your computer and use it in GitHub Desktop.
Why does this crash
+ (TLAdView *)adViewForTopLevelTab:(NSDictionary *)topLevelTab
frame:(CGRect)frame
parentViewController:(UIViewController *)parentViewController
{
TLLog( @"BCWebAdView:adViewForTopLevelTab:frame:%@", NSStringFromRect(frame) );
NSString *adViewClassName = @"BCWebAdView";
TLAdView *adView = nil;
if ([adViewClassName isEqualToString: @"GlamAdView"]) {
NSLog(@"Warning: Glam ads not supported in this version of TapLynx. Please contact [email protected] if you see this message.");
return nil;
}
/*
adView = [UIButton buttonWithType:UIButtonTypeRoundedRect];
//[adView setFrame:CGRectMake(0.0f, 100.0f, 320.0f, 50.0f)];
[adView setFrame:frame];
adView.backgroundColor = [UIColor greenColor];
adView.opaque = YES;
*/
if ([adView isKindOfClass:NSClassFromString(@"MedialetsAdView")]) {
NSLog(@"Warning: Medialets are not supported in this version of TapLynx. Please contact [email protected] if you see this message.");
}
return adView;
}
-(void) createButtonTLAdView{
NSLog(@"createButtonTLAdView");
adButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[adButton setFrame:CGRectMake(0.0f, 100.0f, 320.0f, 50.0f)];
adButton.backgroundColor = [UIColor greenColor];
adButton.opaque = YES;
NSLog(@"thisbutton %@", adButton);
[self addSubview:adButton];
[self bringSubviewToFront:adButton];
}
- (id)initWithAd:(UIView *)anAd delegate:(id<TLAdViewDelegate>)aDelegate {
[self createButtonTLAdView];
if ( ! [super initWithFrame:anAd.frame] ) return nil;
TLLog(@"--- initWithAd ---");
[self setDelegate:aDelegate];
[TLUtil setOrigin:anAd origin:CGPointMake(0.0f, 0.0f)];
//[self setBackgroundColor:[UIColor blueColor]];//TODO: revert to clearColor
// [self setBackgroundColor:[UIColor clearColor]];
[anAd setBackgroundColor:[UIColor clearColor]];
TLLog( @"TLAdView:initWithAd:setBackgroundColor:clearColor:self:%@ anAd:%@", self, anAd );
if ([anAd isKindOfClass:[BCWebAdView class]]) {
[TLUtil setHeight:self height:[BCWebAdView preferredHeightForAd:anAd]];
}
[self addSubview:anAd];
[self setAdView:anAd];
return self;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment