Skip to content

Commit

Permalink
twitter
Browse files Browse the repository at this point in the history
  • Loading branch information
normansander committed Nov 10, 2014
1 parent b976562 commit 1aff428
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CriticalMass.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
90F46A24D8DB4FCAABF4CF34 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1FD3CAC801A84BBA8D151E5D /* libPods.a */; };
941511091A10004D0010205B /* PLTwitterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 941511081A10004D0010205B /* PLTwitterViewController.m */; };
942E2D8219C316BD00BF92D7 /* PLUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 942E2D8119C316BD00BF92D7 /* PLUtils.m */; };
945441AE1A111A6A00C8024F /* PLLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 945441AD1A111A6A00C8024F /* PLLabel.m */; };
94709B0219CA705A003E9583 /* PLInfoOverlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 94709B0119CA705A003E9583 /* PLInfoOverlayView.m */; };
9474656419CA3078005485BD /* PLSettingsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9474656319CA3078005485BD /* PLSettingsTableViewController.m */; };
94A9C1AF19BF43AB0027C5DC /* PLData.m in Sources */ = {isa = PBXBuildFile; fileRef = 94A9C1AE19BF43AB0027C5DC /* PLData.m */; };
Expand Down Expand Up @@ -48,6 +49,8 @@
941511081A10004D0010205B /* PLTwitterViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PLTwitterViewController.m; sourceTree = "<group>"; };
942E2D8019C316BD00BF92D7 /* PLUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PLUtils.h; sourceTree = "<group>"; };
942E2D8119C316BD00BF92D7 /* PLUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PLUtils.m; sourceTree = "<group>"; };
945441AC1A111A6A00C8024F /* PLLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PLLabel.h; sourceTree = "<group>"; };
945441AD1A111A6A00C8024F /* PLLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PLLabel.m; sourceTree = "<group>"; };
94709B0019CA705A003E9583 /* PLInfoOverlayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PLInfoOverlayView.h; sourceTree = "<group>"; };
94709B0119CA705A003E9583 /* PLInfoOverlayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PLInfoOverlayView.m; sourceTree = "<group>"; };
9474656219CA3078005485BD /* PLSettingsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PLSettingsTableViewController.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -163,6 +166,8 @@
942E2D8119C316BD00BF92D7 /* PLUtils.m */,
94709B0019CA705A003E9583 /* PLInfoOverlayView.h */,
94709B0119CA705A003E9583 /* PLInfoOverlayView.m */,
945441AC1A111A6A00C8024F /* PLLabel.h */,
945441AD1A111A6A00C8024F /* PLLabel.m */,
);
path = CriticalMass;
sourceTree = "<group>";
Expand Down Expand Up @@ -348,6 +353,7 @@
94709B0219CA705A003E9583 /* PLInfoOverlayView.m in Sources */,
942E2D8219C316BD00BF92D7 /* PLUtils.m in Sources */,
94A9C1AF19BF43AB0027C5DC /* PLData.m in Sources */,
945441AE1A111A6A00C8024F /* PLLabel.m in Sources */,
94F0304919C1E4EC00F86611 /* PLConstants.m in Sources */,
94CF089919BDF227009FFF43 /* PLTabBarController.m in Sources */,
9474656419CA3078005485BD /* PLSettingsTableViewController.m in Sources */,
Expand Down
13 changes: 13 additions & 0 deletions CriticalMass/PLLabel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// PLLabel.h
// CriticalMass
//
// Created by Norman Sander on 10.11.14.
// Copyright (c) 2014 Pokus Labs. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface PLLabel : UILabel

@end
18 changes: 18 additions & 0 deletions CriticalMass/PLLabel.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// PLLabel.m
// CriticalMass
//
// Created by Norman Sander on 10.11.14.
// Copyright (c) 2014 Pokus Labs. All rights reserved.
//

#import "PLLabel.h"

@implementation PLLabel

- (void)drawTextInRect:(CGRect)rect {
UIEdgeInsets insets = {10, 20, 10, 20};
[super drawTextInRect:UIEdgeInsetsInsetRect(rect, insets)];
}

@end
27 changes: 26 additions & 1 deletion CriticalMass/PLTwitterViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#import "PLTwitterViewController.h"
#import "STTWitter.h"
#import "PLLabel.h"

@interface PLTwitterViewController ()

Expand All @@ -18,11 +19,29 @@ @implementation PLTwitterViewController
- (void)viewDidLoad {
[super viewDidLoad];

CGRect frame = CGRectMake(0, 140, self.view.frame.size.width, self.view.frame.size.height-190);
PLLabel *label = [[PLLabel alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 70)];
label.text = @"Latest Tweets of #cmberlin";
[label setFont: [UIFont fontWithName:@"HelveticaNeue-Medium" size:18.0f]];
[self.view addSubview:label];

CGRect frame = CGRectMake(0, 70, self.view.frame.size.width, self.view.frame.size.height - 120);

_tableView = [[UITableView alloc] initWithFrame:frame style:UITableViewStylePlain];
[_tableView setDelegate:self];
[_tableView setDataSource:self];
_tableView.rowHeight = 300;

UIBezierPath *path = [UIBezierPath bezierPath];
[path moveToPoint:CGPointMake(0, 70.0)];
[path addLineToPoint:CGPointMake(self.view.frame.size.width, 70.0)];

CAShapeLayer *shapeLayer = [CAShapeLayer layer];
shapeLayer.path = [path CGPath];
shapeLayer.strokeColor = [[UIColor blackColor] CGColor];
shapeLayer.lineWidth = 1.0;
shapeLayer.fillColor = [[UIColor clearColor] CGColor];

[self.view.layer addSublayer:shapeLayer];

//[_tableVC.tableView registerClass:[HOTwoRowViewCell class] forCellReuseIdentifier:@"CustomCell"];
//_tableVC.tableView.tableHeaderView = [self headerView];
Expand Down Expand Up @@ -82,7 +101,13 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
NSString *screenName = [status valueForKeyPath:@"user.screen_name"];
NSString *dateString = [status valueForKey:@"created_at"];

cell.textLabel.lineBreakMode = NSLineBreakByWordWrapping;
cell.textLabel.numberOfLines = 0;
CGRect rect = CGRectMake(0, 0, cell.frame.size.width, 100);
cell.textLabel.frame = rect;
cell.textLabel.text = text;
cell.textLabel.layer.borderColor = [UIColor blackColor].CGColor;
cell.textLabel.layer.borderWidth = 4.0;
cell.detailTextLabel.text = [NSString stringWithFormat:@"@%@ | %@", screenName, dateString];

return cell;
Expand Down

0 comments on commit 1aff428

Please sign in to comment.