forked from mirrors/linphone-iphone
Fix keyboard auto correction for contact views
Fix contact without first name enhance contact first name / last name sizes
This commit is contained in:
parent
60a08f2bfd
commit
85b809f2c5
3 changed files with 37 additions and 32 deletions
|
|
@ -79,7 +79,7 @@
|
|||
CFStringRef lFirstName = ABRecordCopyValue(contact, kABPersonFirstNameProperty);
|
||||
CFStringRef lLocalizedFirstName = (lFirstName != nil)?ABAddressBookCopyLocalizedLabel(lFirstName):nil;
|
||||
CFStringRef lLastName = ABRecordCopyValue(contact, kABPersonLastNameProperty);
|
||||
CFStringRef lLocalizedLastName = (lFirstName != nil)?ABAddressBookCopyLocalizedLabel(lLastName):nil;
|
||||
CFStringRef lLocalizedLastName = (lLastName != nil)?ABAddressBookCopyLocalizedLabel(lLastName):nil;
|
||||
|
||||
if(lLocalizedFirstName != nil)
|
||||
[firstNameLabel setText: (NSString *)lLocalizedFirstName];
|
||||
|
|
@ -99,33 +99,34 @@
|
|||
CFRelease(lLocalizedFirstName);
|
||||
if(lFirstName != nil)
|
||||
CFRelease(lFirstName);
|
||||
|
||||
// Avatar
|
||||
/*UIImage *image = [FastAddressBook getContactImage:contact thumbnail:true];
|
||||
if(image == nil) {
|
||||
image = [UIImage imageNamed:@"avatar_unknown_small.png"];
|
||||
}
|
||||
[avatarImage setImage:image];*/
|
||||
|
||||
}
|
||||
|
||||
- (void)layoutSubviews {
|
||||
[super layoutSubviews];
|
||||
//
|
||||
// Adapt size
|
||||
//
|
||||
CGRect firstNameFrame = [firstNameLabel frame];
|
||||
CGRect lastNameFrame = [lastNameLabel frame];
|
||||
|
||||
lastNameFrame.origin.x -= firstNameFrame.size.width;
|
||||
|
||||
// Compute firstName size
|
||||
CGSize contraints;
|
||||
contraints.height = [firstNameLabel frame].size.height;
|
||||
contraints.width = ([lastNameLabel frame].size.width + [lastNameLabel frame].origin.x) - [firstNameLabel frame].origin.x;
|
||||
CGSize firstNameSize = [[firstNameLabel text] sizeWithFont:[firstNameLabel font] constrainedToSize: contraints];
|
||||
CGSize firstNameSize = [[firstNameLabel text] sizeWithFont:[firstNameLabel font]];
|
||||
CGSize lastNameSize = [[lastNameLabel text] sizeWithFont:[firstNameLabel font]];
|
||||
float sum = firstNameSize.width + 5 + lastNameSize.width;
|
||||
float limit = self.bounds.size.width - 5 - firstNameFrame.origin.x;
|
||||
if(sum >limit) {
|
||||
firstNameSize.width *= limit/sum;
|
||||
lastNameSize.width *= limit/sum;
|
||||
}
|
||||
|
||||
firstNameFrame.size.width = firstNameSize.width;
|
||||
lastNameFrame.size.width = lastNameSize.width;
|
||||
|
||||
// Compute lastName size & position
|
||||
lastNameFrame.origin.x += firstNameFrame.size.width;
|
||||
lastNameFrame.size.width = (contraints.width + [firstNameLabel frame].origin.x) - lastNameFrame.origin.x;
|
||||
|
||||
lastNameFrame.origin.x = firstNameFrame.origin.x + firstNameFrame.size.width;
|
||||
if(firstNameFrame.size.width)
|
||||
lastNameFrame.origin.x += 5;
|
||||
|
||||
[firstNameLabel setFrame: firstNameFrame];
|
||||
[lastNameLabel setFrame: lastNameFrame];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,18 +3,18 @@
|
|||
<data>
|
||||
<int key="IBDocument.SystemTarget">1296</int>
|
||||
<string key="IBDocument.SystemVersion">11E53</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">2549</string>
|
||||
<string key="IBDocument.AppKitVersion">1138.47</string>
|
||||
<string key="IBDocument.HIToolboxVersion">569.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="NS.object.0">1181</string>
|
||||
<string key="NS.object.0">1498</string>
|
||||
</object>
|
||||
<array key="IBDocument.IntegratedClassDependencies">
|
||||
<string>IBUIImageView</string>
|
||||
<string>IBUIView</string>
|
||||
<string>IBUILabel</string>
|
||||
<string>IBProxyObject</string>
|
||||
<string>IBUIImageView</string>
|
||||
<string>IBUILabel</string>
|
||||
<string>IBUIView</string>
|
||||
</array>
|
||||
<array key="IBDocument.PluginDependencies">
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
|
|
@ -34,11 +34,11 @@
|
|||
</object>
|
||||
<object class="IBUIView" id="675878782">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<int key="NSvFlags">274</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="IBUIImageView" id="275930832">
|
||||
<reference key="NSNextResponder" ref="675878782"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<int key="NSvFlags">300</int>
|
||||
<string key="NSFrame">{{6, 6}, {32, 32}}</string>
|
||||
<reference key="NSSuperview" ref="675878782"/>
|
||||
<reference key="NSWindow"/>
|
||||
|
|
@ -55,6 +55,10 @@
|
|||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="261477247"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:328</string>
|
||||
<object class="NSColor" key="IBUIBackgroundColor" id="497796648">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MCAwAA</bytes>
|
||||
</object>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<int key="IBUIContentMode">7</int>
|
||||
|
|
@ -77,7 +81,6 @@
|
|||
<double key="NSSize">25</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
|
||||
</object>
|
||||
<object class="IBUILabel" id="261477247">
|
||||
<reference key="NSNextResponder" ref="675878782"/>
|
||||
|
|
@ -85,7 +88,9 @@
|
|||
<string key="NSFrame">{{111, 0}, {200, 44}}</string>
|
||||
<reference key="NSSuperview" ref="675878782"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:328</string>
|
||||
<reference key="IBUIBackgroundColor" ref="497796648"/>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<int key="IBUIContentMode">7</int>
|
||||
|
|
@ -108,7 +113,6 @@
|
|||
<double key="NSSize">25</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrameSize">{320, 44}</string>
|
||||
|
|
@ -116,10 +120,7 @@
|
|||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="275930832"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MCAwAA</bytes>
|
||||
</object>
|
||||
<reference key="IBUIBackgroundColor" ref="497796648"/>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
</array>
|
||||
|
|
@ -254,6 +255,6 @@
|
|||
</object>
|
||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
<string key="IBCocoaTouchPluginVersion">1181</string>
|
||||
<string key="IBCocoaTouchPluginVersion">1498</string>
|
||||
</data>
|
||||
</archive>
|
||||
|
|
|
|||
|
|
@ -170,6 +170,9 @@
|
|||
UIEditableTableViewCell *cell = [atableView dequeueReusableCellWithIdentifier:kCellId];
|
||||
if (cell == nil) {
|
||||
cell = [[[UIEditableTableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:kCellId] autorelease];
|
||||
[cell.detailTextField setAutocapitalizationType:UITextAutocapitalizationTypeWords];
|
||||
[cell.detailTextField setAutocorrectionType:UITextAutocorrectionTypeNo];
|
||||
[cell.detailTextField setKeyboardType:UIKeyboardTypeDefault];
|
||||
}
|
||||
|
||||
ABPropertyID property = [[propertyList objectAtIndex:[indexPath row]] intValue];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue