Files
STTweetLabel/STTweetLabelExample/STTweetLabelExample/STViewController.m
Sebastien THIEBAUD 03db6f5d02 Fix #4
2013-01-09 14:15:52 -08:00

76 lines
2.1 KiB
Objective-C
Executable File

//
// STViewController.m
// STTweetLabel
//
// Created by Sebastien Thiebaud on 12/15/12.
// Copyright (c) 2012 Sebastien Thiebaud. All rights reserved.
//
#import "STViewController.h"
#import "STTweetLabel.h"
@interface STViewController ()
@end
@implementation STViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
_tweetLabel = [[STTweetLabel alloc] initWithFrame:CGRectMake(20.0, 60.0, 280.0, 200.0)];
[_tweetLabel setFont:[UIFont fontWithName:@"HelveticaNeue" size:17.0]];
[_tweetLabel setTextColor:[UIColor blackColor]];
[_tweetLabel setText:@"Hi.This is a new tool for @you! Developed by->@SebThiebaud for #iPhone #ObjC... ;-)\nMy GitHub page: https://t.co/pQXDoiYA"];
// Shadow
// [_tweetLabel setShadowColor:[UIColor colorWithWhite:0.8 alpha:1.0]];
// [_tweetLabel setShadowOffset:CGSizeMake(2.0, 1.0)];
STLinkCallbackBlock callbackBlock = ^(STLinkActionType actionType, NSString *link) {
NSString *displayString = NULL;
switch (actionType) {
case STLinkActionTypeAccount:
displayString = [NSString stringWithFormat:@"Twitter account:\n%@", link];
break;
case STLinkActionTypeHashtag:
displayString = [NSString stringWithFormat:@"Twitter hashtag:\n%@", link];
break;
case STLinkActionTypeWebsite:
displayString = [NSString stringWithFormat:@"Website:\n%@", link];
break;
}
[_displayLabel setText:displayString];
};
[_tweetLabel setCallbackBlock:callbackBlock];
[self.view addSubview:_tweetLabel];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end