diff --git a/BCFeedScroller.podspec b/BCFeedScroller.podspec new file mode 100644 index 0000000..22aaa4d --- /dev/null +++ b/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 diff --git a/FeedScroller.xcodeproj/project.pbxproj b/FeedScroller.xcodeproj/project.pbxproj index 95ce78b..703d612 100644 --- a/FeedScroller.xcodeproj/project.pbxproj +++ b/FeedScroller.xcodeproj/project.pbxproj @@ -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 */; }; @@ -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" */; @@ -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; @@ -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; @@ -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; diff --git a/FeedScroller/AppDelegate.m b/FeedScroller/AppDelegate.m index b28e3c2..f525b96 100644 --- a/FeedScroller/AppDelegate.m +++ b/FeedScroller/AppDelegate.m @@ -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; diff --git a/FeedScroller/Classes/BCFeedItemView.m b/FeedScroller/Classes/BCFeedItemView.m index d4cffb7..b3e4def 100644 --- a/FeedScroller/Classes/BCFeedItemView.m +++ b/FeedScroller/Classes/BCFeedItemView.m @@ -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]; @@ -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 diff --git a/FeedScroller/Classes/BCFeedItemViewController.m b/FeedScroller/Classes/BCFeedItemViewController.m index b8688a5..13a12b4 100644 --- a/FeedScroller/Classes/BCFeedItemViewController.m +++ b/FeedScroller/Classes/BCFeedItemViewController.m @@ -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 @@ -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 { @@ -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:@" "]; @@ -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) @@ -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 diff --git a/FeedScroller/ViewController.m b/FeedScroller/ViewController.m index ff47df2..4132062 100644 --- a/FeedScroller/ViewController.m +++ b/FeedScroller/ViewController.m @@ -64,9 +64,4 @@ - (void)bcFeedItem:(BCFeedItemViewController *)bcFeedItem itemView:(BCFeedItemVi [view.backgroundImageView setImage:[UIImage imageNamed:@"background2.png"]]; } -- (void)dealloc { - [feedViewController release]; - [super dealloc]; -} - @end