Skip to content

Commit

Permalink
Added ability to transition between alert views
Browse files Browse the repository at this point in the history
  • Loading branch information
Friend-LGA committed Nov 7, 2015
1 parent ef8aef9 commit c033fbe
Show file tree
Hide file tree
Showing 8 changed files with 229 additions and 47 deletions.
7 changes: 5 additions & 2 deletions Demo/LGAlertViewDemo/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="14F1021" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<scenes>
Expand All @@ -20,17 +20,20 @@
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright © 2015 Grigory Lutkov. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="obG-Y5-kRd">
<rect key="frame" x="20" y="559" width="560" height="21"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="LGAlertViewDemo" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">
<rect key="frame" x="20" y="180" width="560" height="43"/>
<animations/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="centerX" secondItem="obG-Y5-kRd" secondAttribute="centerX" id="5cz-MP-9tL"/>
Expand Down
4 changes: 2 additions & 2 deletions Demo/LGAlertViewDemo/TableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ - (id)init
@"Custom ActionSheet Styles"];

[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];

self.clearsSelectionOnViewWillAppear = YES;
}
return self;
}
Expand Down Expand Up @@ -90,8 +92,6 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
TableViewControllerCustomActionSheet *tableViewController = [TableViewControllerCustomActionSheet new];
[self.navigationController pushViewController:tableViewController animated:YES];
}

[tableView deselectRowAtIndexPath:indexPath animated:YES];
}

@end
31 changes: 30 additions & 1 deletion Demo/LGAlertViewDemo/TableViewControllerActionSheet.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ - (id)init
@"LGAlertView + UIView",
@"LGAlertView + ActivityIndicator",
@"LGAlertView + ActivityIndicator cancel",
@"LGAlertView + ProgressView cancel"];
@"LGAlertView + ProgressView cancel",
@"LGAlertView + Transition"];

[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
UIEdgeInsets contentInset = self.tableView.contentInset;
Expand Down Expand Up @@ -308,6 +309,34 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath

[self updateProgressWithAlertView:alertView];
}
else if (indexPath.row == 13)
{
LGAlertView *alertView1 = [[LGAlertView alloc] initWithActivityIndicatorAndTitle:@"Loading"
message:@"Waiting please"
style:LGAlertViewStyleActionSheet
buttonTitles:nil
cancelButtonTitle:@"I'm hurry"
destructiveButtonTitle:nil
actionHandler:nil
cancelHandler:nil
destructiveHandler:nil];
[alertView1 showAnimated:YES completionHandler:nil];

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^(void)
{
LGAlertView *alertView2 = [[LGAlertView alloc] initWithTitle:@"Title"
message:@"Message"
style:LGAlertViewStyleAlert
buttonTitles:@[@"Button 1", @"Button 2"]
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"Destructive"
actionHandler:nil
cancelHandler:nil
destructiveHandler:nil];

[alertView1 transitionToAlertView:alertView2 completionHandler:nil];
});
}

[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
Expand Down
31 changes: 30 additions & 1 deletion Demo/LGAlertViewDemo/TableViewControllerAlert.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ - (id)init
@"LGAlertView + UIView",
@"LGAlertView + ActivityIndicator",
@"LGAlertView + ActivityIndicator cancel",
@"LGAlertView + ProgressView cancel"];
@"LGAlertView + ProgressView cancel",
@"LGAlertView + Transition"];

[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
UIEdgeInsets contentInset = self.tableView.contentInset;
Expand Down Expand Up @@ -398,6 +399,34 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath

[self updateProgressWithAlertView:alertView];
}
else if (indexPath.row == 18)
{
LGAlertView *alertView1 = [[LGAlertView alloc] initWithActivityIndicatorAndTitle:@"Loading"
message:@"Waiting please"
style:LGAlertViewStyleAlert
buttonTitles:nil
cancelButtonTitle:@"I'm hurry"
destructiveButtonTitle:nil
actionHandler:nil
cancelHandler:nil
destructiveHandler:nil];
[alertView1 showAnimated:YES completionHandler:nil];

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^(void)
{
LGAlertView *alertView2 = [[LGAlertView alloc] initWithTitle:@"Title"
message:@"Message"
style:LGAlertViewStyleActionSheet
buttonTitles:@[@"Button 1", @"Button 2"]
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"Destructive"
actionHandler:nil
cancelHandler:nil
destructiveHandler:nil];

[alertView1 transitionToAlertView:alertView2 completionHandler:nil];
});
}

[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
Expand Down
4 changes: 2 additions & 2 deletions Demo/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- LGAlertView (2.0.0)
- LGAlertView (2.0.2)

DEPENDENCIES:
- LGAlertView (from `../`)
Expand All @@ -9,6 +9,6 @@ EXTERNAL SOURCES:
:path: ../

SPEC CHECKSUMS:
LGAlertView: a70295bb08ecb940da71b6009b14199a3b580453
LGAlertView: 044299d2a66674a13c04d397555ffc5e4a666831

COCOAPODS: 0.39.0
2 changes: 1 addition & 1 deletion LGAlertView.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = 'LGAlertView'
s.version = '2.0.1'
s.version = '2.0.2'
s.platform = :ios, '6.0'
s.license = 'MIT'
s.homepage = 'https://github.com/Friend-LGA/LGAlertView'
Expand Down
2 changes: 2 additions & 0 deletions LGAlertView/LGAlertView.h
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,8 @@ LGAlertViewWindowLevel;
- (void)showAnimated:(BOOL)animated completionHandler:(void(^)())completionHandler;
- (void)dismissAnimated:(BOOL)animated completionHandler:(void(^)())completionHandler;

- (void)transitionToAlertView:(LGAlertView *)alertView completionHandler:(void(^)())completionHandler;

- (void)setProgress:(float)progress progressLabelText:(NSString *)progressLabelText;

- (void)setButtonAtIndex:(NSUInteger)index enabled:(BOOL)enabled;
Expand Down
Loading

0 comments on commit c033fbe

Please sign in to comment.