diff --git a/UI7Kit.xcodeproj/project.pbxproj b/UI7Kit.xcodeproj/project.pbxproj index d4eb6d6..43aff12 100644 --- a/UI7Kit.xcodeproj/project.pbxproj +++ b/UI7Kit.xcodeproj/project.pbxproj @@ -127,7 +127,7 @@ 38740493176825D900C0BB18 /* UI7Utilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UI7Utilities.m; sourceTree = ""; }; 3888FC60176C7C7900489638 /* UITIssue1ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITIssue1ViewController.h; sourceTree = ""; }; 3888FC61176C7C7900489638 /* UITIssue1ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITIssue1ViewController.m; sourceTree = ""; }; - 3888FC64176C8EBB00489638 /* libPods.a */ = {isa = PBXFileReference; lastKnownFileType = file; name = libPods.a; path = "Pods/build/Release-iphoneos/libPods.a"; sourceTree = ""; }; + 3888FC64176C8EBB00489638 /* libPods.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libPods.a; path = "Pods/build/Release-iphoneos/libPods.a"; sourceTree = ""; }; 38BC0E5A173E821700F36497 /* UITSubviewTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITSubviewTableViewController.h; sourceTree = ""; }; 38BC0E5B173E821700F36497 /* UITSubviewTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UITSubviewTableViewController.m; sourceTree = ""; }; 38C7A9761495181800381910 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; diff --git a/UI7Kit/UI7AlertView.m b/UI7Kit/UI7AlertView.m index 9930dd8..048f92f 100644 --- a/UI7Kit/UI7AlertView.m +++ b/UI7Kit/UI7AlertView.m @@ -54,7 +54,7 @@ - (UIView *)frameView { } - (void)setFrameView:(UIView *)frameView { - [UI7AlertViewFrameViews setObject:frameView forKey:self.pointerString]; + UI7AlertViewFrameViews[self.pointerString] = frameView; } - (UIView *)strokeView { @@ -62,7 +62,7 @@ - (UIView *)strokeView { } - (void)setStrokeView:(UIView *)strokeView { - [UI7AlertViewStrokeViews setObject:strokeView forKey:self.pointerString]; + UI7AlertViewStrokeViews[self.pointerString] = strokeView; } @end @@ -131,7 +131,7 @@ - (id)init { if (self != nil) { self.backgroundImageView = [UIImage blankImage].view; UIView *frameView = self.frameView = [[[UIView alloc] initWithFrame:CGRectMake(.0, .0, 284.0, 141.0)] autorelease]; - frameView.backgroundColor = [UIColor iOS7BackgroundColor]; // temp + frameView.backgroundColor = [UIColor colorWith8BitWhite:233 alpha:255]; self.strokeView = [[UIView alloc] initWithFrame:CGRectMake(.0, .0, frameView.frame.size.width, 0.5)]; self.strokeView.backgroundColor = [UIColor colorWith8BitWhite:182 alpha:255]; @@ -151,14 +151,9 @@ - (void)show { self.titleLabel.font = [UIFont iOS7SystemFontOfSize:16.0 weight:UI7FontWeightMedium]; self.bodyTextLabel.font = [UIFont iOS7SystemFontOfSize:16.0 weight:UI7FontWeightLight]; - { - CGRect frame = self.strokeView.frame; - frame.origin.y = self.bodyTextLabel.frame.origin.y + self.bodyTextLabel.frame.size.height + 29.5f; - self.strokeView.frame = frame; - } - self.frameView.frame = self.bounds; + CGFloat highest = self.frame.size.height; for (UIAlertButton *button in self.buttons) { button.titleLabel.font = [UIFont iOS7SystemFontOfSize:16.0 weight:UI7FontWeightLight]; [button setTitleColor:[UIColor iOS7ButtonTitleColor] forState:UIControlStateNormal]; @@ -168,9 +163,16 @@ - (void)show { [button setBackgroundImage:nil forState:UIControlStateHighlighted]; CGRect frame = button.frame; - frame.size.height = 45.0; - frame.origin.y = self.strokeView.frame.origin.y + 0.5f; + frame.origin.y += 16.0; button.frame = frame; + + highest = MIN(highest, button.frame.origin.y); + } + + { + CGRect frame = self.strokeView.frame; + frame.origin.y = highest - 0.5f; + self.strokeView.frame = frame; } } diff --git a/UI7Kit/UI7ViewController.m b/UI7Kit/UI7ViewController.m index b9758fb..98e7c52 100644 --- a/UI7Kit/UI7ViewController.m +++ b/UI7Kit/UI7ViewController.m @@ -95,19 +95,19 @@ - (void)setTitle:(NSString *)title { } - (UINavigationItem *)navigationItem { - UI7NavigationItem *item = [UI7ViewControllerNavigationItems objectForKey:self.pointerString]; + UI7NavigationItem *item = UI7ViewControllerNavigationItems[self.pointerString]; if (item == nil) { item = [[[UI7NavigationItem alloc] initWithTitle:self.title] autorelease]; - [UI7ViewControllerNavigationItems setObject:item forKey:self.pointerString]; + UI7ViewControllerNavigationItems[self.pointerString] = item; } return item; } - (UIBarButtonItem *)editButtonItem { - UI7BarButtonItem *item = [UI7ViewControllerEditButtonItems objectForKey:self.pointerString]; + UI7BarButtonItem *item = UI7ViewControllerEditButtonItems[self.pointerString]; if (item == nil) { item = [[[UI7BarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(_toggleEditing:)] autorelease]; - [UI7ViewControllerEditButtonItems setObject:item forKey:self.pointerString]; + UI7ViewControllerEditButtonItems[self.pointerString] = item; } return item; } diff --git a/UI7KitTestApp/Storyboard.storyboard b/UI7KitTestApp/Storyboard.storyboard index e5c883e..df04483 100644 --- a/UI7KitTestApp/Storyboard.storyboard +++ b/UI7KitTestApp/Storyboard.storyboard @@ -216,33 +216,78 @@ - - + + + @@ -256,7 +301,10 @@ - + + + + diff --git a/UI7KitTestApp/UITDetailViewController.h b/UI7KitTestApp/UITDetailViewController.h index b3944ce..4ca1855 100644 --- a/UI7KitTestApp/UITDetailViewController.h +++ b/UI7KitTestApp/UITDetailViewController.h @@ -10,8 +10,9 @@ @interface UITDetailViewController : UIViewController -@property (strong, nonatomic) id detailItem; - -@property (strong, nonatomic) IBOutlet UILabel *detailDescriptionLabel; +- (IBAction)showAlertView1:(id)sender; +- (IBAction)showAlertView2:(id)sender; +- (IBAction)showAlertView3:(id)sender; +- (IBAction)showActionSheet:(id)sender; @end diff --git a/UI7KitTestApp/UITDetailViewController.m b/UI7KitTestApp/UITDetailViewController.m index f4d6f69..8a9bbf4 100644 --- a/UI7KitTestApp/UITDetailViewController.m +++ b/UI7KitTestApp/UITDetailViewController.m @@ -9,52 +9,40 @@ #import "UITDetailViewController.h" @interface UITDetailViewController () -@property (strong, nonatomic) UIPopoverController *masterPopoverController; @end -@implementation UITDetailViewController - -- (void)dealloc -{ - [_detailItem release]; - [_detailDescriptionLabel release]; - [super dealloc]; -} - -#pragma mark - Managing the detail item -- (void)setDetailItem:(id)newDetailItem -{ - if (_detailItem != newDetailItem) { - [_detailItem release]; - _detailItem = [newDetailItem retain]; - } +@implementation UITDetailViewController - if (self.masterPopoverController != nil) { - [self.masterPopoverController dismissPopoverAnimated:YES]; +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + if (self) { + self.title = NSLocalizedString(@"Detail", @"Detail"); } + return self; } -- (void)viewDidLoad -{ - [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. +- (void)showAlertView1:(id)sender { + NSString *title = @"Title"; + NSString *message = @"Message"; + [UIAlertView showNoticeWithTitle:title message:message cancelButtonTitle:@"OK"]; } -- (void)didReceiveMemoryWarning -{ - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. +- (void)showAlertView2:(id)sender { + NSString *title = @"Is this test string can be as long as long cat? Or should I test long long longer cat? Like, caaaaaaaaaaaaaaaaaaaaaaaaaaat? I doubt even there is limitation of lines of title or not. Say, is this become long as much as burst to top and bottom of screen? And how much sentence should I write down to reach the end of the screen? I am not a good author. I feel tired to write this sentences."; + NSString *message = @"Is this test string can be as long as long cat? I don't know how much it long, but it should be long enough to finish my test."; + UIAlertView *view = [[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil]; + [view show]; + [view release]; } -- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil -{ - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; - if (self) { - self.title = NSLocalizedString(@"Detail", @"Detail"); - } - return self; +- (void)showAlertView3:(id)sender { + NSString *title = @"Common title"; + NSString *message = @"Uncommon buttons"; + UIAlertView *view = [[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:@"Button1", @"Button2", @"Button3", @"Button4", @"Button5", nil]; + [view show]; + [view release]; } @end diff --git a/UI7KitTestApp/UITSubviewTableViewController.m b/UI7KitTestApp/UITSubviewTableViewController.m index e1906d8..590f7c7 100644 --- a/UI7KitTestApp/UITSubviewTableViewController.m +++ b/UI7KitTestApp/UITSubviewTableViewController.m @@ -72,7 +72,7 @@ - (NSUInteger)subviewTableViewNumberOfSubviews:(UIASubviewTableView *)scrollView } - (UIView *)subviewTableView:(UIASubviewTableView *)scrollView viewForRow:(NSUInteger)row { - return [self->views objectAtIndex:row]; + return self->views[row]; } - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {