Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-23190] iOS: Support Ti.UI.OptionDialog property "tintColor" #7934

Merged
merged 2 commits into from
Apr 11, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion apidoc/Titanium/UI/OptionDialog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ excludes:
backgroundImage,backgroundLeftCap,backgroundRepeat,backgroundSelectedColor,
backgroundSelectedImage,backgroundTopCap,borderColor,borderRadius,borderWidth,bottom,center,
children,clipMode,focusable,height,horizontalWrap,keepScreenOn,layout,left,opacity,overrideCurrentAnimation,
pullBackgroundColor,rect,right,size,softKeyboardOnFocus,tintColor,top,touchEnabled,transform,
pullBackgroundColor,rect,right,size,softKeyboardOnFocus,top,touchEnabled,transform,
viewShadowColor,viewShadowOffset,viewShadowRadius,visible,width,zIndex]

events:
Expand Down
1 change: 1 addition & 0 deletions iphone/Classes/TiUIOptionDialogProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
UIActionSheet *actionSheet;
UIAlertController* alertController;
TiViewProxy *dialogView;
UIColor *tintColor;
CGRect dialogRect;
BOOL animated;
NSUInteger accumulatedOrientationChanges;
Expand Down
16 changes: 13 additions & 3 deletions iphone/Classes/TiUIOptionDialogProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ @implementation TiUIOptionDialogProxy
- (void) dealloc
{
RELEASE_TO_NIL(actionSheet);
RELEASE_TO_NIL(dialogView);
RELEASE_TO_NIL(dialogView);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation

RELEASE_TO_NIL(tintColor);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

RELEASE_TO_NIL_AUTORELEASE(alertController);
[super dealloc];
}
Expand Down Expand Up @@ -57,14 +58,16 @@ -(void)show:(id)args
forceOpaqueBackground = [TiUtils boolValue:[self valueForKey:@"opaquebackground"] def:NO];
persistentFlag = [TiUtils boolValue:[self valueForKey:@"persistent"] def:YES];
cancelButtonIndex = [TiUtils intValue:[self valueForKey:@"cancel"] def:-1];
tintColor = [[TiUtils colorValue:[self valueForKey:@"tintColor"]] _color];
destructiveButtonIndex = [TiUtils intValue:[self valueForKey:@"destructive"] def:-1];

if (cancelButtonIndex >= [options count]) {
cancelButtonIndex = -1;
}

if (destructiveButtonIndex >= [options count]) {
destructiveButtonIndex = -1;
}


[self setDialogView:[args objectForKey:@"view"]];
animated = [TiUtils boolValue:@"animated" properties:args def:YES];
Expand All @@ -85,6 +88,10 @@ -(void)show:(id)args
message:[TiUtils stringValue:[self valueForKey:@"message"]]
preferredStyle:UIAlertControllerStyleActionSheet] retain];

if (tintColor) {
[[alertController view] setTintColor:tintColor];
}

int curIndex = 0;
//Configure the Buttons
for (id btn in options) {
Expand Down Expand Up @@ -151,7 +158,10 @@ -(void)show:(id)args
[actionSheet addButtonWithTitle:thisButtonName];
}


if (tintColor) {
[actionSheet setTintColor:tintColor];
}

[actionSheet setCancelButtonIndex:cancelButtonIndex];
[actionSheet setDestructiveButtonIndex:destructiveButtonIndex];

Expand Down