Skip to content

Instantly share code, notes, and snippets.

- (void)methodOne{
//This is the button created for the subview Ad
adView = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[adView setFrame:frame];
adView.backgroundColor = [UIColor greenColor];
adView.opaque = YES;
[adView setUserInteractionEnabled:YES];
[adView addTarget:self action:@selector(_adButtonTappedTLAdView:event:) forControlEvents:UIControlEventAllTouchEvents];
@projectxcappe
projectxcappe / gist:1419147
Created December 1, 2011 19:22
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;
@projectxcappe
projectxcappe / gist:1420583
Created December 1, 2011 23:09
addTarget to another class
//BCWebAdView.m
-(void)testmethod:(id)sender{
NSLog(@"testmethod");
}
//-----------//
//TLAdView.m
#import "TLAdView.h"
@projectxcappe
projectxcappe / gist:1424983
Created December 2, 2011 21:49
this is shit.
- (void)adButtonTapped:(id)sender {
TLLog( @"BCWebAdView:adButtonTapped:sender:%@", sender );
[self _adButtonTapped:sender event:nil];
}
- (void)_adButtonTapped:(id)sender event:(UIEvent *)e {
...
UIButton *adButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[adButton setFrame:CGRectMake(0.0f, 0.0f, 320.0f, 50.0f)];
adButton.backgroundColor = [UIColor purpleColor];
//[self.view addSubview:adButton];
if ((-self.beacon.rssi < strip.pixels.count)) {
pixcount = -self.beacon.rssi;
NSLog(@"1 - %d", pixcount);
}else {
pixcount = strip.pixels.count; //should be 72
NSLog(@"2 - %d", pixcount);
}
/*
- (void)renderComets {
NSArray *strips = PPDeviceRegistry.sharedRegistry.strips;
if (strips.count >= self.numStrips) {
for (NSUInteger s=0; s<self.numStrips; s++) {
PPStrip *strip = strips[s];
for (int i=0; i<strip.pixels.count; i++) {
PPPixel *pix = strip.pixels[i];
pix.red = pix.green = pix.blue = 0;
}
NSMutableArray *stripComets = self.comets[s];
Venues
{
"venue_name":"John",
"place":30,
"image":null,
"num_restaurants":12
}
@projectxcappe
projectxcappe / label.swift
Created December 21, 2017 20:21
Dynamic UILabel with Rounded Background
class LabelWithBgImage : UILabel {
var topInset: CGFloat = 0.0
var bottomInset: CGFloat = 0.0
var leftInset: CGFloat = 10.0
var rightInset: CGFloat = 10.0
public override init(frame: CGRect) {
super.init(frame: frame)
}
<NSHTTPURLResponse: 0x60400042e540> { URL: http://166.62.92.171/lineopner/index.php/api/login } { Status Code: 200, Headers {
"Cache-Control" = (
"no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
);
"Content-Length" = (
56
);
"Content-Type" = (
"application/json"
);