This repository has been archived by the owner on Jan 25, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
one massive commit because breaking it up is hard
-new tint color for entire app -image selector view controller supports multiple sizes -reverted PIN screen to apear from bottom -new lock & splash images -other small fixes
- Loading branch information
John Flanagan
authored and
John Flanagan
committed
Jun 29, 2012
1 parent
c010ff4
commit 16b6638
Showing
26 changed files
with
235 additions
and
90 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// ImageContainerView.h | ||
// MiniKeePass | ||
// | ||
// Created by John Flanagan on 6/28/12. | ||
// Copyright (c) 2012 Self. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface ImageContainerView : UIView { | ||
NSMutableArray *imageViews; | ||
UIImageView *selectedImageView; | ||
} | ||
|
||
- (void)setSelectedImage:(NSUInteger)index; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
// | ||
// ImageContainerView.m | ||
// MiniKeePass | ||
// | ||
// Created by John Flanagan on 6/28/12. | ||
// Copyright (c) 2012 Self. All rights reserved. | ||
// | ||
|
||
#import "ImageContainerView.h" | ||
#import "MiniKeePassAppDelegate.h" | ||
|
||
//#define IMAGES_PER_ROW 7 | ||
#define SIZE 24 | ||
#define HORIZONTAL_SPACING 10.5 | ||
#define VERTICAL_SPACING 10.5 | ||
|
||
NSInteger imagesPerRow; | ||
NSUInteger selectedImageIndex; | ||
|
||
@implementation ImageContainerView | ||
|
||
- (id)initWithFrame:(CGRect)frame { | ||
self = [super initWithFrame:frame]; | ||
|
||
if (self) { | ||
imagesPerRow = self.frame.size.width / (SIZE + 2 * HORIZONTAL_SPACING); | ||
imageViews = [[NSMutableArray alloc] initWithCapacity:NUM_IMAGES]; | ||
// Get the application delegate | ||
MiniKeePassAppDelegate *appDelegate = (MiniKeePassAppDelegate*)[[UIApplication sharedApplication] delegate]; | ||
|
||
// Load the images | ||
for (int i = 0; i < NUM_IMAGES; i++) { | ||
UIImage *image = [appDelegate loadImage:i]; | ||
|
||
UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; | ||
[self addSubview:imageView]; | ||
[imageViews addObject:imageView]; | ||
[imageView release]; | ||
} | ||
|
||
UIImage *selectedImage = [UIImage imageNamed:@"checkmark"]; | ||
selectedImageView = [[UIImageView alloc] initWithImage:selectedImage]; | ||
[self addSubview:selectedImageView]; | ||
|
||
[self setSelectedImage:0]; | ||
} | ||
return self; | ||
} | ||
|
||
-(void)dealloc { | ||
[imageViews release]; | ||
[selectedImageView release]; | ||
[super dealloc]; | ||
} | ||
|
||
- (void)layoutSubviews { | ||
UIScrollView *scrollView = (UIScrollView *)self.superview; | ||
self.frame = scrollView.frame; | ||
|
||
imagesPerRow = self.frame.size.width / (SIZE + 2 * HORIZONTAL_SPACING); | ||
int numberOfRows = 0; | ||
|
||
CGRect imageFrame = CGRectMake(HORIZONTAL_SPACING, VERTICAL_SPACING, SIZE, SIZE); | ||
|
||
// Load the images | ||
for (int i = 0; i < NUM_IMAGES; i += imagesPerRow) { | ||
numberOfRows++; | ||
for (int j = 0; j < imagesPerRow; j++) { | ||
if (i + j >= NUM_IMAGES) { | ||
break; | ||
} | ||
|
||
UIImageView *imageView = (UIImageView *)[imageViews objectAtIndex:i + j]; | ||
imageView.frame = imageFrame; | ||
|
||
imageFrame.origin.x += SIZE + 2 * HORIZONTAL_SPACING; | ||
} | ||
|
||
imageFrame.origin.x = HORIZONTAL_SPACING; | ||
imageFrame.origin.y += SIZE + 2 * VERTICAL_SPACING; | ||
} | ||
|
||
[self setSelectedImage:selectedImageIndex]; | ||
|
||
CGFloat newHeight = numberOfRows * (SIZE + 2 * VERTICAL_SPACING); | ||
|
||
CGRect newFrame = self.frame; | ||
newFrame.size.height = newHeight; | ||
self.frame = newFrame; | ||
|
||
scrollView.contentSize = newFrame.size; | ||
} | ||
|
||
- (void)setSelectedImage:(NSUInteger)index { | ||
if (index >= NUM_IMAGES) { | ||
return; | ||
} | ||
selectedImageIndex = index; | ||
|
||
NSUInteger row = index / imagesPerRow; | ||
NSUInteger col = index - (row * imagesPerRow); | ||
|
||
CGSize size = selectedImageView.image.size; | ||
CGRect frame = CGRectMake((col + 1) * (SIZE + 2 * HORIZONTAL_SPACING) - size.width, (row + 1) * (SIZE + 2 * VERTICAL_SPACING) - size.height, size.width, size.height); | ||
selectedImageView.frame = frame; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.