Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
sberrevoets committed Jun 4, 2014
1 parent 7e1aab1 commit 23e0912
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ The project also depends on [RBBAnimation](https://github.com/robb/RBBAnimation)
## Usage
`SDCAlertView` is for use in iOS 7 only. It will not work properly on iOS 6.1 or below. Using `SDCAlertView` is very simple: just import SDCAlertView.h and use it as you would `UIAlertView`.

### Basic

Showing a basic `SDCAlertView` alert looks just like showing a basic `UIAlertView` alert:
```objc
SDCAlertView *alert = [[SDCAlertView alloc] initWithTitle:@"Title"
Expand All @@ -39,6 +41,8 @@ Or you can use one of the convenience methods:
[SDCAlertView alertWithTitle:@"Title" message:@"This is a message" buttons:@[@"OK"]];
```

### Block syntax

Block syntax saves you from having to use a delegate:
```objc
SDCAlertView *alert = [[SDCAlertView alloc] initWithTitle:@"Title"
Expand All @@ -51,6 +55,8 @@ SDCAlertView *alert = [[SDCAlertView alloc] initWithTitle:@"Title"
}];
```
### `contentView`
Of course, you're not using `SDCAlertView`'s full potential unless you are using the `contentView`:
```objc
SDCAlertView *alert = [[SDCAlertView alloc] initWithTitle:@"Title"
Expand All @@ -70,6 +76,8 @@ spinner.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;
[alert show];
```

### Additional delegate methods

You can also use the `alertView:shouldDismissWithButtonIndex:` and `alertView:shouldDeselectButtonAtIndex:` to prevent an alert from dismissing:
```objc
- (void)showAlert {
Expand All @@ -91,6 +99,8 @@ You can also use the `alertView:shouldDismissWithButtonIndex:` and `alertView:sh
```
This will deselect the cancel button when it's tapped, but it won't actually dismiss the alert. Useful for password-like alerts that you don't want dismissed until the right password is entered.

### Styling and appearance

`SDCAlertView` uses the `tintColor` for buttons and any subviews you add to the `contentView`. If you are looking for more customizations, you can use `UIAppearance` to style alerts (per instance or all at once):
```objc
[[SDCAlertView appearance] setTitleLabelFont:[UIFont boldSystemFontOfSize:22]];
Expand Down

0 comments on commit 23e0912

Please sign in to comment.