diff --git a/HTProgressHUD/HTProgressHUD.m b/HTProgressHUD/HTProgressHUD.m index aa86731..61dc9de 100755 --- a/HTProgressHUD/HTProgressHUD.m +++ b/HTProgressHUD/HTProgressHUD.m @@ -30,7 +30,8 @@ @implementation HTProgressHUD #pragma mark - Class methods -+ (NSOperationQueue *)operationQueue { ++ (NSOperationQueue *)operationQueue +{ static dispatch_once_t onceToken; static NSOperationQueue *queue; dispatch_once(&onceToken, ^{ @@ -43,7 +44,8 @@ + (NSOperationQueue *)operationQueue { #pragma mark Layout -- (CGRect)updatePositionForHUDFrame:(CGRect)frame { +- (CGRect)updatePositionForHUDFrame:(CGRect)frame +{ CGRect viewBounds = [self bounds]; CGPoint center = CGPointMake(viewBounds.origin.x + floorf(viewBounds.size.width / 2.0f), viewBounds.origin.y + floorf(viewBounds.size.height / 2.0f)); @@ -90,7 +92,8 @@ - (CGRect)updatePositionForHUDFrame:(CGRect)frame { return frame; } -- (void)updatePosition { +- (void)updatePosition +{ CGRect frame = [self updatePositionForHUDFrame:self.hudView.frame]; switch (self.position) { case HTProgressHUDPositionTopLeft: @@ -126,7 +129,8 @@ - (void)updatePosition { self.hudView.frame = frame; } -- (void)updateHUD { +- (void)updateHUD +{ // Indicator size CGRect indicatorFrame = self.indicatorView.frame; indicatorFrame.origin.y = self.hudView.bounds.origin.y + self.paddingInsets.top; @@ -157,7 +161,8 @@ - (void)updateHUD { self.hudView.frame = frame; } -- (void)updateViews { +- (void)updateViews +{ if (self.animateWhenLayoutChanged && !self.hidden) { if (![[NSThread currentThread] isMainThread]) { [self performSelectorOnMainThread:@selector(updateViews) withObject:nil waitUntilDone:NO]; @@ -186,11 +191,13 @@ - (void)updateViews { #pragma mark - Initializers -- (instancetype)init { +- (instancetype)init +{ return [self initWithFrame:CGRectMake(0.0f, 0.0f, 100.0f, 100.0f)]; } -- (instancetype)initWithFrame:(CGRect)frame { +- (instancetype)initWithFrame:(CGRect)frame +{ self = [super initWithFrame:frame]; if (self) { // Self-Configurations @@ -268,27 +275,33 @@ - (instancetype)initWithFrame:(CGRect)frame { #pragma mark Showing methods -- (void)showInView:(UIView *)view { +- (void)showInView:(UIView *)view +{ [self showInView:view animated:YES]; } -- (void)showAboveView:(UIView *)view { +- (void)showAboveView:(UIView *)view +{ [self showInRect:view.frame inView:view.superview]; } -- (void)showInView:(UIView *)view animated:(BOOL)animated { +- (void)showInView:(UIView *)view animated:(BOOL)animated +{ [self showInRect:view.bounds inView:view animated:animated]; } -- (void)showAboveView:(UIView *)view animated:(BOOL)animated { +- (void)showAboveView:(UIView *)view animated:(BOOL)animated +{ [self showInRect:view.frame inView:view.superview animated:animated]; } -- (void)showInRect:(CGRect)rect inView:(UIView *)view { +- (void)showInRect:(CGRect)rect inView:(UIView *)view +{ [self showInRect:rect inView:view animated:YES]; } -- (void)showInRect:(CGRect)rect inView:(UIView *)view animated:(BOOL)animated { +- (void)showInRect:(CGRect)rect inView:(UIView *)view animated:(BOOL)animated +{ if (![[NSThread currentThread] isMainThread]) { dispatch_async(dispatch_get_main_queue(), ^{ [self showInRect:rect inView:view animated:animated]; @@ -325,15 +338,18 @@ - (void)showInRect:(CGRect)rect inView:(UIView *)view animated:(BOOL)animated { #pragma mark Showing with thread methods -- (void)showInView:(UIView *)view whileExecuting:(SEL)method onTarget:(id)target withObject:(id)object animated:(BOOL)animated { +- (void)showInView:(UIView *)view whileExecuting:(SEL)method onTarget:(id)target withObject:(id)object animated:(BOOL)animated +{ [self showInRect:view.bounds inView:view whileExecuting:method onTarget:target withObject:object animated:animated]; } -- (void)showAboveView:(UIView *)view whileExecuting:(SEL)method onTarget:(id)target withObject:(id)object animated:(BOOL)animated { +- (void)showAboveView:(UIView *)view whileExecuting:(SEL)method onTarget:(id)target withObject:(id)object animated:(BOOL)animated +{ [self showInRect:view.frame inView:view.superview whileExecuting:method onTarget:target withObject:object animated:animated]; } -- (void)showInRect:(CGRect)rect inView:(UIView *)view whileExecuting:(SEL)method onTarget:(id)target withObject:(id)object animated:(BOOL)animated { +- (void)showInRect:(CGRect)rect inView:(UIView *)view whileExecuting:(SEL)method onTarget:(id)target withObject:(id)object animated:(BOOL)animated +{ NSMethodSignature *signature = [[target class] instanceMethodSignatureForSelector:method]; NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; [invocation setTarget:target]; @@ -345,15 +361,18 @@ - (void)showInRect:(CGRect)rect inView:(UIView *)view whileExecuting:(SEL)method [self showInRect:rect inView:view whileExecutingInvocation:invocation animated:animated]; } -- (void)showInView:(UIView *)view whileExecutingInvocation:(NSInvocation *)invocation animated:(BOOL)animated { +- (void)showInView:(UIView *)view whileExecutingInvocation:(NSInvocation *)invocation animated:(BOOL)animated +{ [self showInRect:view.bounds inView:view whileExecutingInvocation:invocation animated:animated]; } -- (void)showAboveView:(UIView *)view whileExecutingInvocation:(NSInvocation *)invocation animated:(BOOL)animated { +- (void)showAboveView:(UIView *)view whileExecutingInvocation:(NSInvocation *)invocation animated:(BOOL)animated +{ [self showInRect:view.frame inView:view.superview whileExecutingInvocation:invocation animated:animated]; } -- (void)showInRect:(CGRect)rect inView:(UIView *)view whileExecutingInvocation:(NSInvocation *)invocation animated:(BOOL)animated { +- (void)showInRect:(CGRect)rect inView:(UIView *)view whileExecutingInvocation:(NSInvocation *)invocation animated:(BOOL)animated +{ NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithInvocation:invocation]; [operation setCompletionBlock:^{ [self hideWithAnimation:animated]; @@ -363,15 +382,18 @@ - (void)showInRect:(CGRect)rect inView:(UIView *)view whileExecutingInvocation:( } -- (void)showWithAnimation:(BOOL)animated inView:(UIView *)view whileExecutingBlock:(dispatch_block_t)block { +- (void)showWithAnimation:(BOOL)animated inView:(UIView *)view whileExecutingBlock:(dispatch_block_t)block +{ [self showWithAnimation:animated inRect:view.bounds inView:view whileExecutingBlock:block]; } -- (void)showWithAnimation:(BOOL)animated aboveView:(UIView *)view whileExecutingBlock:(dispatch_block_t)block { +- (void)showWithAnimation:(BOOL)animated aboveView:(UIView *)view whileExecutingBlock:(dispatch_block_t)block +{ [self showWithAnimation:animated inRect:view.frame inView:view.superview whileExecutingBlock:block]; } -- (void)showWithAnimation:(BOOL)animated inRect:(CGRect)rect inView:(UIView *)view whileExecutingBlock:(dispatch_block_t)block { +- (void)showWithAnimation:(BOOL)animated inRect:(CGRect)rect inView:(UIView *)view whileExecutingBlock:(dispatch_block_t)block +{ NSBlockOperation *operation = [NSBlockOperation blockOperationWithBlock:block]; [operation setCompletionBlock:^{ [self hideWithAnimation:animated]; @@ -383,11 +405,13 @@ - (void)showWithAnimation:(BOOL)animated inRect:(CGRect)rect inView:(UIView *)vi #pragma mark Hiding methods -- (void)hide { +- (void)hide +{ [self hideWithAnimation:YES]; } -- (void)hideWithAnimation:(BOOL)animated { +- (void)hideWithAnimation:(BOOL)animated +{ if (![[NSThread currentThread] isMainThread]) { dispatch_async(dispatch_get_main_queue(), ^{ [self hideWithAnimation:animated]; @@ -418,11 +442,13 @@ - (void)hideWithAnimation:(BOOL)animated { } } -- (void)hideAfterDelay:(NSTimeInterval)delay { +- (void)hideAfterDelay:(NSTimeInterval)delay +{ [self hideAfterDelay:delay animated:YES]; } -- (void)hideAfterDelay:(NSTimeInterval)delay animated:(BOOL)animated { +- (void)hideAfterDelay:(NSTimeInterval)delay animated:(BOOL)animated +{ NSMethodSignature *signature = [[self class] instanceMethodSignatureForSelector:@selector(hideWithAnimation:)]; NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; [invocation setTarget:self]; @@ -434,7 +460,8 @@ - (void)hideAfterDelay:(NSTimeInterval)delay animated:(BOOL)animated { #pragma mark Animation callback -- (void)animationDidFinishWithType:(HTProgressHUDAnimationType)animationType { +- (void)animationDidFinishWithType:(HTProgressHUDAnimationType)animationType +{ self.onShowingAnimation = NO; switch (animationType) { case HTProgressHUDAnimationTypeShowing: @@ -467,12 +494,14 @@ - (void)animationDidFinishWithType:(HTProgressHUDAnimationType)animationType { #pragma mark - Getters and Setters -- (void)setPosition:(HTProgressHUDPosition)position { +- (void)setPosition:(HTProgressHUDPosition)position +{ _position = position; [self updateViews]; } -- (void)setText:(NSString *)text { +- (void)setText:(NSString *)text +{ _text = text; dispatch_async(dispatch_get_main_queue(), ^{ self.textLabel.text = text; @@ -480,30 +509,35 @@ - (void)setText:(NSString *)text { }); } -- (void)setIndicatorView:(HTProgressHUDIndicatorView *)indicatorView { +- (void)setIndicatorView:(HTProgressHUDIndicatorView *)indicatorView +{ [_indicatorView removeFromSuperview]; _indicatorView = indicatorView; [self.hudView addSubview:indicatorView]; [self updateViews]; } -- (void)setMarginInsets:(UIEdgeInsets)marginInsets { +- (void)setMarginInsets:(UIEdgeInsets)marginInsets +{ _marginInsets = marginInsets; [self updateViews]; } -- (void)setPaddingInsets:(UIEdgeInsets)paddingInsets { +- (void)setPaddingInsets:(UIEdgeInsets)paddingInsets +{ _paddingInsets = paddingInsets; [self updateViews]; } -- (void)setProgress:(float)progress { +- (void)setProgress:(float)progress +{ _progress = progress; self.indicatorView.progress = progress; [self updateViews]; } -- (void)setOnShowingAnimation:(BOOL)onShowingAnimation { +- (void)setOnShowingAnimation:(BOOL)onShowingAnimation +{ _onShowingAnimation = onShowingAnimation; if (!onShowingAnimation && self.shouldHideWithAnimation) { [self hideWithAnimation:YES]; @@ -515,7 +549,8 @@ - (void)setOnShowingAnimation:(BOOL)onShowingAnimation { #pragma mark UIView overrides -- (void)layoutSubviews { +- (void)layoutSubviews +{ [super layoutSubviews]; [self updateHUD]; [self updatePosition]; diff --git a/HTProgressHUD/HTProgressHUDAnimation.m b/HTProgressHUD/HTProgressHUDAnimation.m index 1e9a9f3..d05c802 100755 --- a/HTProgressHUD/HTProgressHUDAnimation.m +++ b/HTProgressHUD/HTProgressHUDAnimation.m @@ -17,36 +17,44 @@ @implementation HTProgressHUDAnimation #pragma mark - Class methods -+ (instancetype)animation { ++ (instancetype)animation +{ return [[[self class] alloc] init]; } #pragma mark - Public methods -- (void)setUpShowingAnimation:(HTProgressHUD *)progressHUD { +- (void)setUpShowingAnimation:(HTProgressHUD *)progressHUD +{ } -- (void)performShowingAnimation:(HTProgressHUD *)progressHUD { +- (void)performShowingAnimation:(HTProgressHUD *)progressHUD +{ } -- (void)tearDownShowingAnimation:(HTProgressHUD *)progressHUD { +- (void)tearDownShowingAnimation:(HTProgressHUD *)progressHUD +{ } -- (void)setUpHidingAnimation:(HTProgressHUD *)progressHUD { +- (void)setUpHidingAnimation:(HTProgressHUD *)progressHUD +{ } -- (void)performHidingAnimation:(HTProgressHUD *)progressHUD { +- (void)performHidingAnimation:(HTProgressHUD *)progressHUD +{ } -- (void)tearDownHidingAnimation:(HTProgressHUD *)progressHUD { +- (void)tearDownHidingAnimation:(HTProgressHUD *)progressHUD +{ } -- (void)finishAnimation { +- (void)finishAnimation +{ [self.performingHUD animationDidFinishWithType:self.animationType]; self.performingHUD = nil; } diff --git a/HTProgressHUD/HTProgressHUDFadeAnimation.m b/HTProgressHUD/HTProgressHUDFadeAnimation.m index c531293..f6a69ad 100755 --- a/HTProgressHUD/HTProgressHUDFadeAnimation.m +++ b/HTProgressHUD/HTProgressHUDFadeAnimation.m @@ -11,7 +11,8 @@ @implementation HTProgressHUDFadeAnimation #pragma mark - Initializers -- (instancetype)init { +- (instancetype)init +{ self = [super init]; if (self) { self.duration = 0.3; @@ -28,11 +29,13 @@ - (instancetype)init { #pragma mark Showing animation -- (void)setUpShowingAnimation:(HTProgressHUD *)progressHUD { +- (void)setUpShowingAnimation:(HTProgressHUD *)progressHUD +{ progressHUD.alpha = 0.0f; } -- (void)performShowingAnimation:(HTProgressHUD *)progressHUD { +- (void)performShowingAnimation:(HTProgressHUD *)progressHUD +{ [UIView setAnimationCurve:self.curve]; [UIView animateWithDuration:self.duration animations:^{ @@ -43,15 +46,18 @@ - (void)performShowingAnimation:(HTProgressHUD *)progressHUD { }]; } -- (void)tearDownShowingAnimation:(HTProgressHUD *)progressHUD { +- (void)tearDownShowingAnimation:(HTProgressHUD *)progressHUD +{ } #pragma mark Hiding animation -- (void)setUpHidingAnimation:(HTProgressHUD *)progressHUD { +- (void)setUpHidingAnimation:(HTProgressHUD *)progressHUD +{ } -- (void)performHidingAnimation:(HTProgressHUD *)progressHUD { +- (void)performHidingAnimation:(HTProgressHUD *)progressHUD +{ [UIView setAnimationCurve:self.curve]; [UIView animateWithDuration:self.duration animations:^{ @@ -62,7 +68,8 @@ - (void)performHidingAnimation:(HTProgressHUD *)progressHUD { }]; } -- (void)tearDownHidingAnimation:(HTProgressHUD *)progressHUD { +- (void)tearDownHidingAnimation:(HTProgressHUD *)progressHUD +{ } diff --git a/HTProgressHUD/HTProgressHUDFadeZoomAnimation.m b/HTProgressHUD/HTProgressHUDFadeZoomAnimation.m index 4c98bff..f8ae64a 100755 --- a/HTProgressHUD/HTProgressHUDFadeZoomAnimation.m +++ b/HTProgressHUD/HTProgressHUDFadeZoomAnimation.m @@ -11,7 +11,8 @@ @implementation HTProgressHUDFadeZoomAnimation #pragma mark - Initializers -- (instancetype)init { +- (instancetype)init +{ self = [super init]; if (self) { self.zoomInDuaration = 0.15; @@ -31,12 +32,14 @@ - (instancetype)init { #pragma mark Showing animation -- (void)setUpShowingAnimation:(HTProgressHUD *)progressHUD { +- (void)setUpShowingAnimation:(HTProgressHUD *)progressHUD +{ progressHUD.alpha = 0.0f; progressHUD.transform = CGAffineTransformMakeScale(0.1f, 0.1f); } -- (void)performShowingAnimation:(HTProgressHUD *)progressHUD { +- (void)performShowingAnimation:(HTProgressHUD *)progressHUD +{ [UIView setAnimationCurve:self.zoomInCurve]; [UIView animateWithDuration:self.zoomInDuaration animations:^{ @@ -54,15 +57,18 @@ - (void)performShowingAnimation:(HTProgressHUD *)progressHUD { }]; } -- (void)tearDownShowingAnimation:(HTProgressHUD *)progressHUD { +- (void)tearDownShowingAnimation:(HTProgressHUD *)progressHUD +{ } #pragma mark Hiding animation -- (void)setUpHidingAnimation:(HTProgressHUD *)progressHUD { +- (void)setUpHidingAnimation:(HTProgressHUD *)progressHUD +{ } -- (void)performHidingAnimation:(HTProgressHUD *)progressHUD { +- (void)performHidingAnimation:(HTProgressHUD *)progressHUD +{ [UIView setAnimationCurve:self.zoomInCurve]; [UIView animateWithDuration:self.zoomInDuaration animations:^{ @@ -80,7 +86,8 @@ - (void)performHidingAnimation:(HTProgressHUD *)progressHUD { }]; } -- (void)tearDownHidingAnimation:(HTProgressHUD *)progressHUD { +- (void)tearDownHidingAnimation:(HTProgressHUD *)progressHUD +{ progressHUD.alpha = 1.0f; progressHUD.transform = CGAffineTransformIdentity; } diff --git a/HTProgressHUD/HTProgressHUDIndicatorView.m b/HTProgressHUD/HTProgressHUDIndicatorView.m index 0e87fce..60688c5 100755 --- a/HTProgressHUD/HTProgressHUDIndicatorView.m +++ b/HTProgressHUD/HTProgressHUDIndicatorView.m @@ -13,7 +13,8 @@ @implementation HTProgressHUDIndicatorView #pragma mark - Class methods -+ (HTProgressHUDIndicatorView *)indicatorViewWithType:(HTProgressHUDIndicatorType)type { ++ (HTProgressHUDIndicatorView *)indicatorViewWithType:(HTProgressHUDIndicatorType)type +{ switch (type) { case HTProgressHUDIndicatorTypeActivityIndicator:{ UIActivityIndicatorView *activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; @@ -31,11 +32,13 @@ + (HTProgressHUDIndicatorView *)indicatorViewWithType:(HTProgressHUDIndicatorTyp #pragma mark - Initializers -- (instancetype)init { +- (instancetype)init +{ return [self initWithFrame:CGRectMake(0.0f, 0.0f, 50.0f, 50.0f)]; } -- (instancetype)initWithFrame:(CGRect)frame { +- (instancetype)initWithFrame:(CGRect)frame +{ self = [super initWithFrame:frame]; if (self) { self.opaque = NO; @@ -44,7 +47,8 @@ - (instancetype)initWithFrame:(CGRect)frame { return self; } -- (instancetype)initWithCustomView:(UIView *)view { +- (instancetype)initWithCustomView:(UIView *)view +{ self = [self initWithFrame:CGRectMake(0.0f, 0.0f, view.frame.size.width, view.frame.size.height)]; if (self) { [self addSubview:view]; @@ -57,7 +61,8 @@ - (instancetype)initWithCustomView:(UIView *)view { #pragma mark - Getters and Setters -- (void)setProgress:(float)progress { +- (void)setProgress:(float)progress +{ _progress = progress; [self performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:nil waitUntilDone:NO]; } diff --git a/HTProgressHUD/HTProgressHUDPieIndicatorView.m b/HTProgressHUD/HTProgressHUDPieIndicatorView.m index 25aede0..6d9e2be 100755 --- a/HTProgressHUD/HTProgressHUDPieIndicatorView.m +++ b/HTProgressHUD/HTProgressHUDPieIndicatorView.m @@ -11,7 +11,8 @@ @implementation HTProgressHUDPieIndicatorView #pragma mark - Initializers -- (instancetype)initWithFrame:(CGRect)frame { +- (instancetype)initWithFrame:(CGRect)frame +{ self = [super initWithFrame:frame]; if (self) { self.tintColor = [UIColor whiteColor]; @@ -25,7 +26,8 @@ - (instancetype)initWithFrame:(CGRect)frame { #pragma mark UIView overrides -- (void)drawRect:(CGRect)rect { +- (void)drawRect:(CGRect)rect +{ [super drawRect:rect]; CGPoint center = CGPointMake(rect.origin.x + floorf(rect.size.height / 2.0f), rect.origin.y + floorf(rect.size.height / 2.0f)); diff --git a/HTProgressHUD/HTProgressHUDRingIndicatorView.m b/HTProgressHUD/HTProgressHUDRingIndicatorView.m index cb9e2dc..cca1ed4 100755 --- a/HTProgressHUD/HTProgressHUDRingIndicatorView.m +++ b/HTProgressHUD/HTProgressHUDRingIndicatorView.m @@ -11,7 +11,8 @@ @implementation HTProgressHUDRingIndicatorView #pragma mark - Initializers -- (instancetype)initWithFrame:(CGRect)frame { +- (instancetype)initWithFrame:(CGRect)frame +{ self = [super initWithFrame:frame]; if (self) { self.tintColor = [UIColor whiteColor]; @@ -27,7 +28,8 @@ - (instancetype)initWithFrame:(CGRect)frame { #pragma mark UIView overrides -- (void)drawRect:(CGRect)rect { +- (void)drawRect:(CGRect)rect +{ [super drawRect:rect]; CGPoint center = CGPointMake(rect.origin.x + floorf(rect.size.height / 2.0f), rect.origin.y + floorf(rect.size.height / 2.0f)); diff --git a/HTProgressHUDExample/HTProgressHUDExample/HTViewController.m b/HTProgressHUDExample/HTProgressHUDExample/HTViewController.m index 2da1065..bde7f0b 100644 --- a/HTProgressHUDExample/HTProgressHUDExample/HTViewController.m +++ b/HTProgressHUDExample/HTProgressHUDExample/HTViewController.m @@ -19,20 +19,23 @@ @implementation HTViewController #pragma mark - Private methods -- (void)simple { +- (void)simple +{ HTProgressHUD *HUD = [[HTProgressHUD alloc] init]; [HUD showInView:self.view]; [HUD hideAfterDelay:3]; } -- (void)withText { +- (void)withText +{ HTProgressHUD *HUD = [[HTProgressHUD alloc] init]; HUD.text = @"Loading..."; [HUD showInView:self.view]; [HUD hideAfterDelay:3]; } -- (void)progress { +- (void)progress +{ HTProgressHUD *HUD = [[HTProgressHUD alloc] init]; HUD.indicatorView = [HTProgressHUDIndicatorView indicatorViewWithType:HTProgressHUDIndicatorTypePie]; HUD.text = @"Uploading..."; @@ -45,7 +48,8 @@ - (void)progress { }]; } -- (void)zoomAnimationWithRing { +- (void)zoomAnimationWithRing +{ HTProgressHUD *HUD = [[HTProgressHUD alloc] init]; HUD.indicatorView = [HTProgressHUDIndicatorView indicatorViewWithType:HTProgressHUDIndicatorTypeRing]; HUD.animation = [HTProgressHUDFadeZoomAnimation animation]; @@ -59,7 +63,8 @@ - (void)zoomAnimationWithRing { }]; } --(void)textOnly{ +-(void)textOnly +{ HTProgressHUD *HUD = [[HTProgressHUD alloc] initWithFrame:CGRectMake(0, 0, 100, 40)]; HUD.text = @"Hello, World!"; @@ -88,7 +93,8 @@ -(void)textOnly{ #pragma mark UIViewController overrides -- (void)viewDidLoad { +- (void)viewDidLoad +{ [super viewDidLoad]; self.title = @"HTProgressHUD Demo"; @@ -110,21 +116,25 @@ - (void)viewDidLoad { }]; } -- (void)didReceiveMemoryWarning { +- (void)didReceiveMemoryWarning +{ [super didReceiveMemoryWarning]; } #pragma mark - Table view data source methods -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ return 1; } -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ return 5; } -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"]; @@ -150,7 +160,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N #pragma mark - Table view delegate methods -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ [tableView deselectRowAtIndexPath:indexPath animated:YES]; switch (indexPath.row) { case 0: