Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:appcelerator/titanium_mobile

  • Loading branch information...
commit 09cfc026715b6a508a33db206263cb245a024699 2 parents 5a2a16b + d31358e
@jhaynie jhaynie authored
View
4 iphone/Classes/TiUITableView.m
@@ -544,6 +544,8 @@ -(void)setBounds:(CGRect)bounds
[(TiUIViewProxy*)[(TiUIView*)footerView proxy] reposition];
[[self tableView] setTableFooterView:footerView];
}
+
+ [tableview reloadData];
}
- (void)triggerActionForIndexPath:(NSIndexPath *)indexPath fromPath:(NSIndexPath*)fromPath tableView:(UITableView*)ourTableView wasAccessory: (BOOL)accessoryTapped search:(BOOL)viaSearch name:(NSString*)name
@@ -1045,12 +1047,14 @@ -(void)configurationSet
}
}
+/*
-(void)setData_:(NSArray *)newData
{
NSDictionary * properties = [NSDictionary dictionaryWithObject:NUMINT(UITableViewRowAnimationNone) forKey:@"animationStyle"];
TiUITableViewAction *action = [[[TiUITableViewAction alloc] initWithRow:nil animation:properties section:0 type:TiUITableViewActionSetData] autorelease];
[self dispatchAction:action];
}
+*/
-(void)setSearchHidden_:(id)hide
{
View
1  iphone/Classes/TiUITableViewRowProxy.h
@@ -27,6 +27,7 @@ typedef enum
TiUITableView *table;
TiUITableViewSectionProxy *section;
TiDimension height;
+ CGFloat rowHeight;
UIView * rowContainerView;
BOOL modifyingRow;
View
34 iphone/Classes/TiUITableViewRowProxy.m
@@ -28,7 +28,6 @@ @interface TiSelectedCellBackgroundView : UIView
#define ROUND_SIZE 10
-
@implementation TiSelectedCellBackgroundView
@synthesize position,fillColor;
@@ -200,6 +199,7 @@ - (void) dealloc
@end
+#define ACCESSORY_WIDTH 20
@implementation TiUITableViewRowProxy
@@ -245,6 +245,13 @@ -(void)setLayout:(id)value
[self replaceValue:value forKey:@"layout" notification:YES];
}
+-(BOOL)hasAccessory
+{
+ return ([TiUtils boolValue:[self valueForKey:@"hasChild"] def:NO] ||
+ [TiUtils boolValue:[self valueForKey:@"hasDetail"] def:NO] ||
+ [TiUtils boolValue:[self valueForKey:@"hasCheck"] def:NO]);
+}
+
-(CGFloat)rowHeight:(CGRect)bounds
{
if (TiDimensionIsPixels(height))
@@ -254,9 +261,29 @@ -(CGFloat)rowHeight:(CGRect)bounds
CGFloat result = 0;
if (TiDimensionIsAuto(height))
{
- result = [self autoHeightForWidth:bounds.size.width];
+ CGFloat realWidth = bounds.size.width;
+ if ([self hasAccessory]) {
+ realWidth -= ACCESSORY_WIDTH;
+ }
+
+ id rightImage = [self valueForKey:@"rightImage"];
+ if (rightImage != nil) {
+ NSURL *url = [TiUtils toURL:rightImage proxy:self];
+ UIImage *image = [[ImageLoader sharedLoader] loadImmediateImage:url];
+ realWidth -= [image size].width;
+ }
+
+ id leftImage = [self valueForKey:@"leftImage"];
+ if (leftImage != nil) {
+ NSURL *url = [TiUtils toURL:leftImage proxy:self];
+ UIImage *image = [[ImageLoader sharedLoader] loadImmediateImage:url];
+ realWidth -= [image size].width;
+ }
+ result = [self autoHeightForWidth:realWidth];
}
- return result == 0 ? [table tableRowHeight:0] : result;
+ // Have to cache the value for later!
+ rowHeight = (result == 0) ? [table tableRowHeight:0] : result;
+ return rowHeight;
}
-(void)updateRow:(NSDictionary *)data withObject:(NSDictionary *)properties
@@ -504,7 +531,6 @@ -(void)configureChildren:(UITableViewCell*)cell
{
UIView *contentView = cell.contentView;
CGRect rect = [contentView frame];
- CGFloat rowHeight = [self rowHeight:rect];
if (rect.size.height < rowHeight)
{
rect.size.height = rowHeight;
Please sign in to comment.
Something went wrong with that request. Please try again.