Skip to content

Commit

Permalink
ARC and podfile
Browse files Browse the repository at this point in the history
  • Loading branch information
priore committed May 7, 2015
1 parent 239cec6 commit 52277bc
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 84 deletions.
20 changes: 20 additions & 0 deletions BCFeedScroller.podspec
@@ -0,0 +1,20 @@
Pod::Spec.new do |s|
s.name = "BCFeedScroller"
s.version = "1.0.1"
s.summary = "Two classes for showing animated feed."
s.homepage = "https://github.com/priore/BCFeedScroller"
s.license = 'MIT'
s.author = { "Danilo Priore" => "support@prioregroup.com" }
s.platform = :ios
s.ios.deployment_target = '5.1.1'
s.source = {
:git => "https://github.com/priore/BCFeedScroller.git",
:tag => "1.0.1"
}
s.requires_arc = false
s.subspec 'BCFeedScroller' do |ss|
ss.source_files = 'FeedScroller/Classes/BCFeedItemView.{h,m}',
'FeedScroller/Classes/BCFeedItemViewController.{h,m}'
ss.dependency 'MWFeedParser', '~> 1.0.1'
end
end
52 changes: 10 additions & 42 deletions FeedScroller.xcodeproj/project.pbxproj
Expand Up @@ -14,12 +14,12 @@
9F42B82A15F4BAA900118A70 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F42B82915F4BAA900118A70 /* Foundation.framework */; };
9F42B82C15F4BAA900118A70 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F42B82B15F4BAA900118A70 /* CoreGraphics.framework */; };
9F42B83215F4BAA900118A70 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9F42B83015F4BAA900118A70 /* InfoPlist.strings */; };
9F42B83415F4BAA900118A70 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F42B83315F4BAA900118A70 /* main.m */; };
9F42B83815F4BAA900118A70 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F42B83715F4BAA900118A70 /* AppDelegate.m */; };
9F42B83B15F4BAA900118A70 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F42B83A15F4BAA900118A70 /* ViewController.m */; };
9F42B83415F4BAA900118A70 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F42B83315F4BAA900118A70 /* main.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
9F42B83815F4BAA900118A70 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F42B83715F4BAA900118A70 /* AppDelegate.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
9F42B83B15F4BAA900118A70 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F42B83A15F4BAA900118A70 /* ViewController.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
9F42B83E15F4BAA900118A70 /* ViewController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F42B83C15F4BAA900118A70 /* ViewController_iPhone.xib */; };
9F42B85E15F4BBE000118A70 /* BCFeedItemView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F42B84A15F4BBE000118A70 /* BCFeedItemView.m */; };
9F42B85F15F4BBE000118A70 /* BCFeedItemViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F42B84C15F4BBE000118A70 /* BCFeedItemViewController.m */; };
9F42B85E15F4BBE000118A70 /* BCFeedItemView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F42B84A15F4BBE000118A70 /* BCFeedItemView.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
9F42B85F15F4BBE000118A70 /* BCFeedItemViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F42B84C15F4BBE000118A70 /* BCFeedItemViewController.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
9F42B86015F4BBE000118A70 /* GTMNSString+HTML.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F42B85015F4BBE000118A70 /* GTMNSString+HTML.m */; };
9F42B86115F4BBE000118A70 /* MWFeedInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F42B85215F4BBE000118A70 /* MWFeedInfo.m */; };
9F42B86215F4BBE000118A70 /* MWFeedItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F42B85415F4BBE000118A70 /* MWFeedItem.m */; };
Expand Down Expand Up @@ -218,7 +218,7 @@
9F42B81A15F4BAA900118A70 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0440;
LastUpgradeCheck = 0630;
ORGANIZATIONNAME = "Danilo Priore";
};
buildConfigurationList = 9F42B81D15F4BAA900118A70 /* Build configuration list for PBXProject "FeedScroller" */;
Expand Down Expand Up @@ -298,48 +298,20 @@
9F42B84215F4BAA900118A70 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1";
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
9F42B84315F4BAA900118A70 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -350,9 +322,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "FeedScroller/FeedScroller-Prefix.pch";
INFOPLIST_FILE = "FeedScroller/FeedScroller-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.1;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = 1;
WRAPPER_EXTENSION = app;
};
name = Debug;
Expand All @@ -363,9 +333,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "FeedScroller/FeedScroller-Prefix.pch";
INFOPLIST_FILE = "FeedScroller/FeedScroller-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.1;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = 1;
WRAPPER_EXTENSION = app;
};
name = Release;
Expand Down
11 changes: 2 additions & 9 deletions FeedScroller/AppDelegate.m
Expand Up @@ -30,17 +30,10 @@

@implementation AppDelegate

- (void)dealloc
{
[_window release];
[_viewController release];
[super dealloc];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil] autorelease];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
Expand Down
13 changes: 1 addition & 12 deletions FeedScroller/Classes/BCFeedItemView.m
Expand Up @@ -74,7 +74,7 @@ - (id)initWithFrame:(CGRect)frame {
[self addSubview:dayLabel];

// title
int titleXPos = dayLabel.frame.origin.x + dayLabel.frame.size.width;
int titleXPos = dayLabel.frame.origin.x + dayLabel.frame.size.width + 5;
textLabel = [[UILabel alloc] initWithFrame:CGRectMake(titleXPos, y, frame.size.width - titleXPos - MARGIN_SIZE, 20)];
textLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
textLabel.backgroundColor = [UIColor clearColor];
Expand Down Expand Up @@ -126,15 +126,4 @@ - (id)initWithFrame:(CGRect)frame {
return self;
}

- (void)dealloc {

[textLabel release];
[descriptionLabel release];
[dayLabel release];
[monthLabel release];
[yearLabel release];
[backgroundImageView release];
[super dealloc];
}

@end
21 changes: 5 additions & 16 deletions FeedScroller/Classes/BCFeedItemViewController.m
Expand Up @@ -78,11 +78,11 @@ - (void)viewDidLoad {
[self.view addSubview:view_2];

// enable gesture (tap) for view 1
UITapGestureRecognizer *tapGesture_1 = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didFeedItemSelected:)] autorelease];
UITapGestureRecognizer *tapGesture_1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didFeedItemSelected:)];
[view_1 addGestureRecognizer:tapGesture_1];

// enable gesture (tap) for view 2
UITapGestureRecognizer *tapGesture_2 = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didFeedItemSelected:)] autorelease];
UITapGestureRecognizer *tapGesture_2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didFeedItemSelected:)];
[view_2 addGestureRecognizer:tapGesture_2];

// buffer for parser
Expand Down Expand Up @@ -117,8 +117,6 @@ - (void)feedParserDidFinish:(MWFeedParser *)parser {
NSTimer *timer = [NSTimer timerWithTimeInterval:presentationInterval target:self selector:@selector(didNextFeedItem) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
}

[parser release];
}

- (void)didNextFeedItem {
Expand Down Expand Up @@ -146,7 +144,7 @@ - (void)didNextFeedItem {
viewIn.descriptionLabel.text = feedItem.summary;

// format the data
NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"dd MMMM yyyy"];
NSString *dataS = [formatter stringFromDate:feedItem.date];
NSArray *dataA = [dataS componentsSeparatedByString:@" "];
Expand Down Expand Up @@ -230,13 +228,13 @@ - (void)didFeedItemSelected:(UIViewController*)viewController
- (void)fitHeightLabel:(UILabel*)label maxHeight:(CGFloat)maxHeight
{
CGRect frame = label.frame;
NSString *text = [[label.text copy] autorelease];
NSString *text = [label.text copy];
label.lineBreakMode = UILineBreakModeWordWrap;
label.numberOfLines = 999;
CGSize constraintSize = CGSizeMake(frame.size.width, MAXFLOAT);
CGSize labelSize = [text sizeWithFont:label.font
constrainedToSize:constraintSize
lineBreakMode:UILineBreakModeWordWrap];
lineBreakMode:0];

frame.size.height = maxHeight;
if (labelSize.height < maxHeight)
Expand All @@ -245,13 +243,4 @@ - (void)fitHeightLabel:(UILabel*)label maxHeight:(CGFloat)maxHeight
label.text = text;
}

- (void)dealloc {

[view_1 release];
[view_2 release];
[parsedItems release];
[feedParser release];
[super dealloc];
}

@end
5 changes: 0 additions & 5 deletions FeedScroller/ViewController.m
Expand Up @@ -64,9 +64,4 @@ - (void)bcFeedItem:(BCFeedItemViewController *)bcFeedItem itemView:(BCFeedItemVi
[view.backgroundImageView setImage:[UIImage imageNamed:@"background2.png"]];
}

- (void)dealloc {
[feedViewController release];
[super dealloc];
}

@end

0 comments on commit 52277bc

Please sign in to comment.