Browse files

- Simplified example

- Removed unecessary view controller
- Removed address book stuff (devs can always add that in themselves, super easy
- Refactored so that the label is part of the token view as opposed to a separate subview outisde the token view
- Improved token layout to wrao around label
  • Loading branch information...
1 parent 5933b78 commit e7fe5146d7197b9ae2ab8c9cbe65ac8ff9b7cca9 James Addyman committed Aug 23, 2011
View
8 JSTokenField.xcodeproj/project.pbxproj
@@ -21,7 +21,6 @@
1A1A06C213FEE2D900CA6645 /* tokenHighlighted@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A1A06BE13FEE2D900CA6645 /* tokenHighlighted@2x.png */; };
1A1A06C313FEE2D900CA6645 /* tokenNormal.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A1A06BF13FEE2D900CA6645 /* tokenNormal.png */; };
1A1A06C413FEE2D900CA6645 /* tokenNormal@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A1A06C013FEE2D900CA6645 /* tokenNormal@2x.png */; };
- 1A1A06C713FEF5F500CA6645 /* JSTokenFieldViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A1A06C613FEF5F400CA6645 /* JSTokenFieldViewController.m */; };
1A1A06CF13FF000C00CA6645 /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A1A06CD13FF000C00CA6645 /* AddressBook.framework */; };
1A1A06D013FF000C00CA6645 /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A1A06CE13FF000C00CA6645 /* AddressBookUI.framework */; };
/* End PBXBuildFile section */
@@ -48,8 +47,6 @@
1A1A06BE13FEE2D900CA6645 /* tokenHighlighted@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "tokenHighlighted@2x.png"; sourceTree = "<group>"; };
1A1A06BF13FEE2D900CA6645 /* tokenNormal.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tokenNormal.png; sourceTree = "<group>"; };
1A1A06C013FEE2D900CA6645 /* tokenNormal@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "tokenNormal@2x.png"; sourceTree = "<group>"; };
- 1A1A06C513FEF5F400CA6645 /* JSTokenFieldViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTokenFieldViewController.h; sourceTree = "<group>"; };
- 1A1A06C613FEF5F400CA6645 /* JSTokenFieldViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSTokenFieldViewController.m; sourceTree = "<group>"; };
1A1A06CD13FF000C00CA6645 /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; };
1A1A06CE13FF000C00CA6645 /* AddressBookUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBookUI.framework; path = System/Library/Frameworks/AddressBookUI.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
@@ -106,8 +103,6 @@
1A1A06AA13FEDEEC00CA6645 /* DemoAppDelegate.m */,
1A1A06AC13FEDEEC00CA6645 /* DemoViewController.h */,
1A1A06AD13FEDEEC00CA6645 /* DemoViewController.m */,
- 1A1A06C513FEF5F400CA6645 /* JSTokenFieldViewController.h */,
- 1A1A06C613FEF5F400CA6645 /* JSTokenFieldViewController.m */,
1A1A06B913FEE01C00CA6645 /* JSTokenField.h */,
1A1A06BA13FEE01C00CA6645 /* JSTokenField.m */,
1A1A06B713FEE01C00CA6645 /* JSTokenButton.h */,
@@ -204,7 +199,6 @@
1A1A06AE13FEDEEC00CA6645 /* DemoViewController.m in Sources */,
1A1A06BB13FEE01C00CA6645 /* JSTokenButton.m in Sources */,
1A1A06BC13FEE01C00CA6645 /* JSTokenField.m in Sources */,
- 1A1A06C713FEF5F500CA6645 /* JSTokenFieldViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -282,6 +276,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "JSTokenField/JSTokenField-Prefix.pch";
INFOPLIST_FILE = "JSTokenField/JSTokenField-Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 4.3;
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
@@ -294,6 +289,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "JSTokenField/JSTokenField-Prefix.pch";
INFOPLIST_FILE = "JSTokenField/JSTokenField-Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 4.3;
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
View
5,385 ...xcodeproj/project.xcworkspace/xcuserdata/james.xcuserdatad/UserInterfaceState.xcuserstate
3,541 additions, 1,844 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
10 JSTokenField/DemoViewController.h
@@ -27,15 +27,17 @@
//
#import <UIKit/UIKit.h>
-#import "JSTokenFieldViewController.h"
#import <AddressBookUI/AddressBookUI.h>
#import <AddressBook/AddressBook.h>
+#import "JSTokenField.h"
-@interface DemoViewController : UITableViewController <JSTokenFieldViewControllerDelegate, JSTokenFieldDelegate, ABPeoplePickerNavigationControllerDelegate> {
+@interface DemoViewController : UIViewController <JSTokenFieldDelegate> {
- NSMutableArray *_recipients;
+ NSMutableArray *_toRecipients;
+ NSMutableArray *_ccRecipients;
- JSTokenFieldViewController *_tokenFieldViewController;
+ JSTokenField *_toField;
+ JSTokenField *_ccField;
}
View
136 JSTokenField/DemoViewController.m
@@ -27,15 +27,15 @@
//
#import "DemoViewController.h"
-#import "JSTokenFieldViewController.h"
+#import "JSTokenField.h"
@implementation DemoViewController
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
- [_recipients release], _recipients = nil;
- [_tokenFieldViewController release], _tokenFieldViewController = nil;
+ [_toRecipients release], _toRecipients = nil;
+ [_toField release], _toField = nil;
[super dealloc];
}
@@ -56,19 +56,24 @@ - (void)viewDidLoad
name:JSTokenFieldFrameDidChangeNotification
object:nil];
- _recipients = [[NSMutableArray alloc] init];
+ _toRecipients = [[NSMutableArray alloc] init];
- _tokenFieldViewController = [[JSTokenFieldViewController alloc] init];
- [_tokenFieldViewController setDelegate:self];
- [self.tableView setTableHeaderView:_tokenFieldViewController.view];
- [_tokenFieldViewController.tokenField setDelegate:self];
+ _toField = [[JSTokenField alloc] initWithFrame:CGRectMake(0, 0, 320, 31)];
+ [[_toField label] setText:@"To:"];
+ [_toField setDelegate:self];
+ [self.view addSubview:_toField];
+
+ _ccField = [[JSTokenField alloc] initWithFrame:CGRectMake(0, 31, 320, 31)];
+ [[_ccField label] setText:@"CC:"];
+ [_ccField setDelegate:self];
+ [self.view addSubview:_ccField];
}
- (void)viewDidUnload
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
- [_recipients release], _recipients = nil;
- [_tokenFieldViewController release], _tokenFieldViewController = nil;
+ [_toRecipients release], _toRecipients = nil;
+ [_toField release], _toField = nil;
[super viewDidUnload];
}
@@ -93,123 +98,32 @@ - (void)viewDidDisappear:(BOOL)animated
}
#pragma mark -
-#pragma mark UITableViewControllerDelegate/DataSource
-
-- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
-{
- return 1;
-}
-
-- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
-{
- return 0;
-}
-
-#pragma mark -
#pragma mark JSTokenFieldDelegate
- (void)tokenField:(JSTokenField *)tokenField didAddToken:(NSString *)title representedObject:(id)obj
{
NSDictionary *recipient = [NSDictionary dictionaryWithObject:obj forKey:title];
- [_recipients addObject:recipient];
- NSLog(@"Added token for < %@ : %@ >\n%@", title, obj, _recipients);
+ [_toRecipients addObject:recipient];
+ NSLog(@"Added token for < %@ : %@ >\n%@", title, obj, _toRecipients);
}
- (void)tokenField:(JSTokenField *)tokenField didRemoveTokenAtIndex:(NSUInteger)index
{
- [_recipients removeObjectAtIndex:index];
- NSLog(@"Deleted token %d\n%@", index, _recipients);
+ [_toRecipients removeObjectAtIndex:index];
+ NSLog(@"Deleted token %d\n%@", index, _toRecipients);
}
- (void)handleTokenFieldFrameDidChange:(NSNotification *)note
{
- CGRect frame = [[_tokenFieldViewController view] frame];
- CGRect newFrame = [[[note userInfo] objectForKey:JSTokenFieldFrameKey] CGRectValue];
-
- [UIView beginAnimations:nil context:nil];
-
- if (newFrame.size.height > 44)
- {
- frame.size.height = newFrame.size.height + 9;
- [[_tokenFieldViewController view] setFrame:frame];
- [_tokenFieldViewController.separator setFrame:CGRectMake(0, frame.size.height-1, 320, 1)];
- }
- else
+ if ([[note object] isEqual:_toField])
{
- frame.size.height = 44;
- [[_tokenFieldViewController view] setFrame:frame];
- [_tokenFieldViewController.separator setFrame:CGRectMake(0, frame.size.height-1, 320, 1)];
+ [UIView animateWithDuration:0.0
+ animations:^{
+ [_ccField setFrame:CGRectMake(0, [_toField frame].size.height + [_toField frame].origin.y, [_ccField frame].size.width, [_ccField frame].size.height)];
+ }
+ completion:nil];
}
-
- CGRect addButtonFrame = [_tokenFieldViewController.addContactButton frame];
- addButtonFrame.origin = CGPointMake((newFrame.origin.x + newFrame.size.width + 4), ((newFrame.origin.y + newFrame.size.height) - addButtonFrame.size.height - 4));
- [_tokenFieldViewController.addContactButton setFrame:addButtonFrame];
-
- [UIView commitAnimations];
-
- [self.tableView setTableHeaderView:[_tokenFieldViewController view]];
-
- if (![[note userInfo] objectForKey:JSDeletedTokenKey])
- {
- [self.tableView scrollRectToVisible:_tokenFieldViewController.view.frame animated:YES];
- }
-}
-
-
-#pragma mark -
-#pragma mark ABPeoplePickerNavigationControllerDelegate
-
-- (void)addContact
-{
- ABPeoplePickerNavigationController *peoplePicker = [[[ABPeoplePickerNavigationController alloc] init] autorelease];
- [peoplePicker setPeoplePickerDelegate:self];
- [self presentModalViewController:peoplePicker animated:YES];
-}
-
-- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
-{
- return YES;
-}
-
-- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker
-{
- [self dismissModalViewControllerAnimated:YES];
-}
-
-- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier
-{
- [self dismissModalViewControllerAnimated:YES];
-
- ABMultiValueRef multiValue = ABRecordCopyValue(person, property);
- NSString *phoneNumber = (NSString *)ABMultiValueCopyValueAtIndex(multiValue, ABMultiValueGetIndexForIdentifier(multiValue, identifier));
- [phoneNumber autorelease];
- CFRelease(multiValue);
-
- NSString *firstName = (NSString *)ABRecordCopyValue(person,kABPersonFirstNameProperty);
- NSString *lastName = (NSString *)ABRecordCopyValue(person,kABPersonLastNameProperty);
-
- [firstName autorelease];
- [lastName autorelease];
-
- NSString *displayName = nil;
-
- if([firstName length] && [lastName length]){
- displayName = [NSString stringWithFormat:@"%@ %@",firstName,lastName];
- }else if([firstName length]){
- displayName = [NSString stringWithFormat:@"%@",firstName];
- }else if([lastName length]){
- displayName = [NSString stringWithFormat:@"%@",lastName];
- }
-
- if ([displayName length] == 0)
- {
- displayName = phoneNumber;
- }
-
- [_tokenFieldViewController.tokenField addTokenWithTitle:displayName representedObject:phoneNumber];
-
- return NO;
}
@end
View
3 JSTokenField/JSTokenField.h
@@ -44,9 +44,12 @@ extern NSString *const JSDeletedTokenKey;
id <JSTokenFieldDelegate> _delegate;
JSTokenButton *_deletedToken;
+
+ UILabel *_label;
}
@property (nonatomic, readonly) UITextField *textField;
+@property (nonatomic, retain) UILabel *label;
@property (nonatomic, readonly, copy) NSMutableArray *tokens;
@property (nonatomic, assign) id <JSTokenFieldDelegate> delegate;
View
44 JSTokenField/JSTokenField.m
@@ -37,6 +37,8 @@
#define HEIGHT_PADDING 3
#define WIDTH_PADDING 6
+#define DEFAULT_HEIGHT 31
+
@interface JSTokenField ()
- (JSTokenButton *)tokenWithString:(NSString *)string representedObject:(id)obj;
@@ -49,18 +51,36 @@ @implementation JSTokenField
@synthesize tokens = _tokens;
@synthesize textField = _textField;
+@synthesize label = _label;
@synthesize delegate = _delegate;
- (id)initWithFrame:(CGRect)frame
{
+ if (frame.size.height < DEFAULT_HEIGHT)
+ {
+ frame.size.height = DEFAULT_HEIGHT;
+ }
+
if ((self = [super initWithFrame:frame]))
{
+ [self setBackgroundColor:[UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:1.0]];
+ UIView *separator = [[[UIView alloc] initWithFrame:CGRectMake(0, frame.size.height-1, frame.size.width, 1)] autorelease];
+ [separator setAutoresizingMask:UIViewAutoresizingFlexibleTopMargin];
+ [self addSubview:separator];
+ [separator setBackgroundColor:[UIColor lightGrayColor]];
+
+ _label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, frame.size.height)];
+ [_label setBackgroundColor:[UIColor clearColor]];
+ [_label setFont:[UIFont systemFontOfSize:17.0]];
+
+ [self addSubview:_label];
+
// self.layer.borderColor = [[UIColor blueColor] CGColor];
// self.layer.borderWidth = 1.0;
_tokens = [[NSMutableArray alloc] init];
- _hiddenTextField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0 , 31, 31)];
+ _hiddenTextField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0 , DEFAULT_HEIGHT, DEFAULT_HEIGHT)];
[_hiddenTextField setHidden:YES];
[_hiddenTextField setDelegate:self];
[self addSubview:_hiddenTextField];
@@ -99,6 +119,7 @@ - (void)dealloc
[[NSNotificationCenter defaultCenter] removeObserver:self];
[_hiddenTextField release], _hiddenTextField = nil;
[_textField release], _textField = nil;
+ [_label release], _label = nil;
[_tokens release], _tokens = nil;
[super dealloc];
@@ -198,6 +219,11 @@ - (void)layoutSubviews
{
CGRect currentRect = CGRectZero;
+ [_label sizeToFit];
+ [_label setFrame:CGRectMake(HEIGHT_PADDING, WIDTH_PADDING, [_label frame].size.width, [_label frame].size.height)];
+
+ currentRect.origin.x += _label.frame.size.width + WIDTH_PADDING;
+
for (UIButton *token in _tokens)
{
CGRect frame = [token frame];
@@ -213,7 +239,15 @@ - (void)layoutSubviews
[token setFrame:frame];
if (![token superview])
+ {
+ [token setAlpha:0.0];
[self addSubview:token];
+ [UIView animateWithDuration:0.5
+ animations:^{
+ [token setAlpha:1.0];
+ }
+ completion:nil];
+ }
currentRect.origin.x += frame.size.width + WIDTH_PADDING;
currentRect.size = frame.size;
@@ -238,7 +272,11 @@ - (void)layoutSubviews
CGRect selfFrame = [self frame];
selfFrame.size.height = textFieldFrame.origin.y + textFieldFrame.size.height + HEIGHT_PADDING;
- [self setFrame:selfFrame];
+ [UIView animateWithDuration:0.3
+ animations:^{
+ [self setFrame:selfFrame];
+ }
+ completion:nil];
}
- (void)toggle:(id)sender
@@ -263,7 +301,7 @@ - (void)setFrame:(CGRect)frame
[userInfo setObject:_deletedToken forKey:JSDeletedTokenKey];
[_deletedToken release], _deletedToken = nil;
}
-
+
[[NSNotificationCenter defaultCenter] postNotificationName:JSTokenFieldFrameDidChangeNotification object:self userInfo:[[userInfo copy] autorelease]];
}
View
56 JSTokenField/JSTokenFieldViewController.h
@@ -1,56 +0,0 @@
-//
-// Copyright 2011 James Addyman (JamSoft). All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without modification, are
-// permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this list of
-// conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice, this list
-// of conditions and the following disclaimer in the documentation and/or other materials
-// provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY JAMES ADDYMAN (JAMSOFT) ``AS IS'' AND ANY EXPRESS OR IMPLIED
-// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JAMES ADDYMAN (JAMSOFT) OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation are those of the
-// authors and should not be interpreted as representing official policies, either expressed
-// or implied, of James Addyman (JamSoft).
-//
-
-#import <UIKit/UIKit.h>
-#import "JSTokenField.h"
-
-@protocol JSTokenFieldViewControllerDelegate;
-
-@interface JSTokenFieldViewController : UIViewController {
-
- JSTokenField *_tokenField;
- UIButton *_addContactButton;
- UIView *_separator;
-
-
- id <JSTokenFieldViewControllerDelegate> _delegate;
-}
-
-@property (nonatomic, retain) JSTokenField *tokenField;
-@property (nonatomic, retain) UIButton *addContactButton;
-@property (nonatomic, assign) id <JSTokenFieldViewControllerDelegate> delegate;
-
-@property (nonatomic, readonly) UIView *separator;
-
-@end
-
-@protocol JSTokenFieldViewControllerDelegate <NSObject>
-
-- (void)addContact;
-
-@end
View
106 JSTokenField/JSTokenFieldViewController.m
@@ -1,106 +0,0 @@
-//
-// Copyright 2011 James Addyman (JamSoft). All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without modification, are
-// permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this list of
-// conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice, this list
-// of conditions and the following disclaimer in the documentation and/or other materials
-// provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY JAMES ADDYMAN (JAMSOFT) ``AS IS'' AND ANY EXPRESS OR IMPLIED
-// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JAMES ADDYMAN (JAMSOFT) OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation are those of the
-// authors and should not be interpreted as representing official policies, either expressed
-// or implied, of James Addyman (JamSoft).
-//
-
-#import "JSTokenFieldViewController.h"
-#import <QuartzCore/QuartzCore.h>
-
-@implementation JSTokenFieldViewController
-
-@synthesize tokenField = _tokenField;
-@synthesize addContactButton = _addContactButton;
-@synthesize delegate = _delegate;
-@synthesize separator = _separator;
-
-- (void)loadView
-{
- self.view = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 44)] autorelease];
- [self.view setBackgroundColor:[UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:1.0]];
-
- UIView *_backgroundView = [[[UIView alloc] initWithFrame:CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y-300, self.view.frame.size.width, 300)] autorelease];
- [_backgroundView setBackgroundColor:[UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:1.0]];
- [self.view addSubview:_backgroundView];
-
- UILabel *toLabel = [[[UILabel alloc] initWithFrame:CGRectMake(5, 6, 30, 30)] autorelease];
- [toLabel setBackgroundColor:[UIColor clearColor]];
- [toLabel setOpaque:NO];
- [toLabel setTextColor:[UIColor colorWithRed:0.3 green:0.3 blue:0.3 alpha:1.0]];
- [toLabel setFont:[UIFont fontWithName:@"Helvetica Neue" size:17.0]];
- [toLabel setText:@"To: "];
- [self.view addSubview:toLabel];
-
- self.tokenField = [[[JSTokenField alloc] initWithFrame:CGRectMake(36, 8, 248, 30)] autorelease];
- [self.view addSubview:self.tokenField];
-
- self.addContactButton = [UIButton buttonWithType:UIButtonTypeContactAdd];
- [self.addContactButton addTarget:self
- action:@selector(addContact)
- forControlEvents:UIControlEventTouchUpInside];
- CGRect frame = [self.addContactButton frame];
- frame.origin = CGPointMake(288, 8);
- [self.addContactButton setFrame:frame];
- [self.view addSubview:self.addContactButton];
-
- _separator = [[[UIView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height-1, 320, 1)] autorelease];
- [self.view addSubview:_separator];
- [_separator setBackgroundColor:[UIColor lightGrayColor]];
-}
-
-
-- (void)didReceiveMemoryWarning {
- // Releases the view if it doesn't have a superview.
- [super didReceiveMemoryWarning];
-
- // Release any cached data, images, etc that aren't in use.
-}
-
-- (void)viewDidUnload {
- [super viewDidUnload];
- // Release any retained subviews of the main view.
- // e.g. self.myOutlet = nil;
-}
-
-
-- (void)dealloc
-{
- [[NSNotificationCenter defaultCenter] removeObserver:self];
-
- self.tokenField = nil;
- self.addContactButton = nil;
-
- [super dealloc];
-}
-
-- (void)addContact
-{
- if ([self.delegate respondsToSelector:@selector(addContact)])
- {
- [self.delegate addContact];
- }
-}
-
-@end
View
91 JSTokenField/en.lproj/DemoViewController.xib
@@ -1,27 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
- <int key="IBDocument.SystemTarget">1280</int>
- <string key="IBDocument.SystemVersion">11C37</string>
- <string key="IBDocument.InterfaceBuilderVersion">1891</string>
- <string key="IBDocument.AppKitVersion">1138.15</string>
- <string key="IBDocument.HIToolboxVersion">567.00</string>
+ <int key="IBDocument.SystemTarget">1056</int>
+ <string key="IBDocument.SystemVersion">11B26</string>
+ <string key="IBDocument.InterfaceBuilderVersion">1617</string>
+ <string key="IBDocument.AppKitVersion">1138</string>
+ <string key="IBDocument.HIToolboxVersion">566.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="NS.object.0">884</string>
+ <string key="NS.object.0">534</string>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>IBProxyObject</string>
- <string>IBUITableView</string>
+ <string>IBUIView</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
- <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
- <integer value="1" key="NS.object.0"/>
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys" id="0">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <reference key="dict.values" ref="0"/>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -33,26 +36,20 @@
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
- <object class="IBUITableView" id="132552264">
+ <object class="IBUIView" id="622831848">
<reference key="NSNextResponder"/>
- <int key="NSvFlags">274</int>
+ <int key="NSvFlags">292</int>
<string key="NSFrameSize">{320, 460}</string>
<reference key="NSSuperview"/>
- <reference key="NSWindow"/>
- <string key="NSReuseIdentifierKey">_NS:175</string>
+ <string key="NSReuseIdentifierKey">_NS:180</string>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
+ <object class="NSColorSpace" key="NSCustomColorSpace">
+ <int key="NSID">2</int>
+ </object>
</object>
- <bool key="IBUIClipsSubviews">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- <bool key="IBUIAlwaysBounceVertical">YES</bool>
- <int key="IBUISeparatorStyle">1</int>
- <int key="IBUISectionIndexMinimumDisplayRowCount">0</int>
- <bool key="IBUIShowsSelectionImmediatelyOnTouchBegin">YES</bool>
- <float key="IBUIRowHeight">44</float>
- <float key="IBUISectionHeaderHeight">22</float>
- <float key="IBUISectionFooterHeight">22</float>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
@@ -62,35 +59,17 @@
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
- <reference key="destination" ref="132552264"/>
+ <reference key="destination" ref="622831848"/>
</object>
- <int key="connectionID">9</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">dataSource</string>
- <reference key="source" ref="132552264"/>
- <reference key="destination" ref="372490531"/>
- </object>
- <int key="connectionID">10</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="132552264"/>
- <reference key="destination" ref="372490531"/>
- </object>
- <int key="connectionID">11</int>
+ <int key="connectionID">13</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
- <object class="NSArray" key="object" id="0">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
+ <reference key="object" ref="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
@@ -106,9 +85,13 @@
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">8</int>
- <reference key="object" ref="132552264"/>
+ <int key="objectID">12</int>
+ <reference key="object" ref="622831848"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
<reference key="parent" ref="0"/>
+ <string key="objectName">View</string>
</object>
</object>
</object>
@@ -120,7 +103,7 @@
<string>-1.IBPluginDependency</string>
<string>-2.CustomClassName</string>
<string>-2.IBPluginDependency</string>
- <string>8.IBPluginDependency</string>
+ <string>12.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -143,21 +126,9 @@
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
- <int key="maxID">11</int>
- </object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <object class="NSMutableArray" key="referencedPartialClassDescriptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">DemoViewController</string>
- <string key="superclassName">UITableViewController</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/DemoViewController.h</string>
- </object>
- </object>
- </object>
+ <int key="maxID">14</int>
</object>
+ <object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
@@ -166,6 +137,6 @@
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
- <string key="IBCocoaTouchPluginVersion">884</string>
+ <string key="IBCocoaTouchPluginVersion">534</string>
</data>
</archive>

0 comments on commit e7fe514

Please sign in to comment.