Customize Settings view colors

This commit is contained in:
Yann Diorcet 2012-07-26 19:10:20 +02:00
parent 597a2fd7b4
commit 173adff74f
7 changed files with 174 additions and 57 deletions

View file

@ -3,19 +3,19 @@
<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>IBProxyObject</string>
<string>IBUIButton</string>
<string>IBUIImageView</string>
<string>IBUIView</string>
<string>IBUILabel</string>
<string>IBProxyObject</string>
<string>IBUIView</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@ -53,7 +53,7 @@
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSCustomResource" key="IBUIImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">contact_bar_background.png</string>
<string key="NSResourceName">history_details_bar_background.png</string>
</object>
</object>
<object class="IBUIButton" id="455083905">
@ -896,12 +896,12 @@
<string key="avatar_unknown_small.png">{131, 131}</string>
<string key="button_background_default.png">{550, 101}</string>
<string key="button_background_over.png">{550, 101}</string>
<string key="contact_bar_background.png">{5, 117}</string>
<string key="history_details_add_default.png">{320, 117}</string>
<string key="history_details_add_over.png">{320, 117}</string>
<string key="history_details_back_default.png">{320, 117}</string>
<string key="history_details_back_over.png">{320, 117}</string>
<string key="history_details_bar_background.png">{5, 117}</string>
</dictionary>
<string key="IBCocoaTouchPluginVersion">1181</string>
<string key="IBCocoaTouchPluginVersion">1498</string>
</data>
</archive>

View file

@ -20,6 +20,9 @@
#ifndef UILINPHONE_H
#define UILINPHONE_H
#define LINPHONE_MAIN_COLOR [UIColor colorWithRed:207.0f/255.0f green:76.0f/255.0f blue:41.0f/255.0f alpha:1.0f]
#define LINPHONE_TABLE_CELL_BACKGROUND_COLOR [UIColor colorWithRed:207.0f/255.0f green:76.0f/255.0f blue:41.0f/255.0f alpha:1.0f]
#endif

View file

@ -19,6 +19,105 @@
#import "SettingsViewController.h"
#import "LinphoneManager.h"
#import "UILinphone.h"
static void removeTableBackground(UIView* view) {
if([view isKindOfClass:[UITableView class]]) {
[view setBackgroundColor:[UIColor clearColor]];
}
for(UIView *subview in [view subviews]) {
removeTableBackground(subview);
}
}
@interface UINavigationBarEx: UINavigationBar {
}
@end
@implementation UINavigationBarEx
#pragma mark - Lifecycle Functions
- (void)initUINavigationBarEx {
[self setTintColor:LINPHONE_MAIN_COLOR];
}
- (id)init {
self = [super init];
if (self) {
[self initUINavigationBarEx];
}
return self;
}
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
[self initUINavigationBarEx];
}
return self;
}
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self initUINavigationBarEx];
}
return self;
}
- (void)drawRect:(CGRect)rect {
UIImage *img = [UIImage imageNamed:@"settings_bar_background.png"];
[img drawInRect:rect];
}
@end
@interface UINavigationControllerEx : UINavigationController
@end
@implementation UINavigationControllerEx
- (id)initWithRootViewController:(UIViewController *)rootViewController {
removeTableBackground(rootViewController.view);
return [super initWithRootViewController:rootViewController];
}
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
removeTableBackground(viewController.view);
UILabel *labelTitleView = [[UILabel alloc] init];
labelTitleView.backgroundColor = [UIColor clearColor];
labelTitleView.textColor = [UIColor colorWithRed:0x41/255.0f green:0x48/255.0f blue:0x4f/255.0f alpha:1.0];
labelTitleView.shadowColor = [UIColor colorWithWhite:1.0 alpha:0.5];
labelTitleView.font = [UIFont boldSystemFontOfSize:20];
labelTitleView.shadowOffset = CGSizeMake(0,1);
labelTitleView.textAlignment = UITextAlignmentCenter;
labelTitleView.text = viewController.navigationItem.title;
[labelTitleView sizeToFit];
viewController.navigationItem.titleView = labelTitleView;
[super pushViewController:viewController animated:animated];
}
- (void)setViewControllers:(NSArray *)viewControllers {
for(UIViewController *controller in viewControllers) {
removeTableBackground(controller.view);
}
[super setViewControllers:viewControllers];
}
- (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated {
for(UIViewController *controller in viewControllers) {
removeTableBackground(controller.view);
}
[super setViewControllers:viewControllers animated:animated];
}
@end
@implementation SettingsViewController
@ -59,17 +158,6 @@ static UICompositeViewDescription *compositeDescription = nil;
}
#pragma mark -
+ (void)removeBackground:(UIView*)view {
if([view isKindOfClass:[UITableView class]]) {
[view setBackgroundColor:[UIColor clearColor]];
}
for(UIView *subview in [view subviews]) {
[SettingsViewController removeBackground:subview];
}
}
#pragma mark - ViewController Functions
- (void)viewDidLoad {
@ -82,8 +170,8 @@ static UICompositeViewDescription *compositeDescription = nil;
settingsController.settingsStore = [[LinphoneManager instance] settingsStore];
navigationController.view.frame = self.view.frame;
[SettingsViewController removeBackground:navigationController.view];
[SettingsViewController removeBackground:settingsController.view];
removeTableBackground(navigationController.view);
[navigationController pushViewController:settingsController animated:FALSE];
[self.view addSubview: navigationController.view];
}

View file

@ -3,20 +3,20 @@
<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>IBUINavigationBar</string>
<string>IBUINavigationItem</string>
<string>IBUIViewController</string>
<string>IBUIView</string>
<string>IBUINavigationController</string>
<string>IBProxyObject</string>
<string>IBUINavigationBar</string>
<string>IBUINavigationController</string>
<string>IBUINavigationItem</string>
<string>IBUIView</string>
<string>IBUIViewController</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@ -48,6 +48,20 @@
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIViewController" id="73380722">
<bool key="IBUIAutoresizesArchivedViewToFullSize">NO</bool>
<object class="IBUINavigationItem" key="IBUINavigationItem" id="1014852814">
<string key="IBUITitle">Settings</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
<int key="IBUIInterfaceOrientation">1</int>
<int key="interfaceOrientation">1</int>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBUIHorizontal">NO</bool>
</object>
<object class="IBUINavigationController" id="983459891">
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
@ -67,24 +81,7 @@
<bool key="IBUIMultipleTouchEnabled">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<array class="NSMutableArray" key="IBUIViewControllers">
<object class="IBUIViewController" id="73380722">
<bool key="IBUIAutoresizesArchivedViewToFullSize">NO</bool>
<object class="IBUINavigationItem" key="IBUINavigationItem" id="1014852814">
<reference key="IBUINavigationBar"/>
<string key="IBUITitle">Settings</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<reference key="IBUIParentViewController" ref="983459891"/>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
<int key="IBUIInterfaceOrientation">1</int>
<int key="interfaceOrientation">1</int>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBUIHorizontal">NO</bool>
</object>
</array>
<array key="IBUIViewControllers" id="0"/>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
@ -97,14 +94,6 @@
</object>
<int key="connectionID">9</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">settingsController</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="73380722"/>
</object>
<int key="connectionID">8</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">navigationController</string>
@ -113,12 +102,20 @@
</object>
<int key="connectionID">15</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">settingsController</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="73380722"/>
</object>
<int key="connectionID">8</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<array key="object" id="0"/>
<reference key="object" ref="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
@ -144,7 +141,6 @@
<reference key="object" ref="983459891"/>
<array class="NSMutableArray" key="children">
<reference ref="890495851"/>
<reference ref="73380722"/>
</array>
<reference key="parent" ref="0"/>
<string key="objectName">navigationController</string>
@ -161,7 +157,7 @@
<array class="NSMutableArray" key="children">
<reference ref="1014852814"/>
</array>
<reference key="parent" ref="983459891"/>
<reference key="parent" ref="0"/>
<string key="objectName">settingsController</string>
</object>
<object class="IBObjectRecord">
@ -177,7 +173,9 @@
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="10.CustomClassName">UINavigationControllerEx</string>
<string key="10.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="11.CustomClassName">UINavigationBarEx</string>
<string key="11.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="14.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@ -233,6 +231,22 @@
<string key="minorKey">./Classes/SettingsViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UINavigationBarEx</string>
<string key="superclassName">UINavigationBar</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/UINavigationBarEx.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UINavigationControllerEx</string>
<string key="superclassName">UINavigationController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/UINavigationControllerEx.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
@ -243,6 +257,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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

View file

@ -666,6 +666,10 @@
D3A8BB7F15A6CC3200F96BE5 /* setup_back_disabled.png in Resources */ = {isa = PBXBuildFile; fileRef = D3A8BB7815A6CC3200F96BE5 /* setup_back_disabled.png */; };
D3A8BB8115A6CC3200F96BE5 /* setup_cancel_disabled.png in Resources */ = {isa = PBXBuildFile; fileRef = D3A8BB7915A6CC3200F96BE5 /* setup_cancel_disabled.png */; };
D3A8BB8315A6CC3200F96BE5 /* setup_start_disabled.png in Resources */ = {isa = PBXBuildFile; fileRef = D3A8BB7A15A6CC3200F96BE5 /* setup_start_disabled.png */; };
D3B82A0215C18A710036C93E /* history_details_bar_background.png in Resources */ = {isa = PBXBuildFile; fileRef = D3B82A0015C18A710036C93E /* history_details_bar_background.png */; };
D3B82A0315C18A710036C93E /* history_details_bar_background.png in Resources */ = {isa = PBXBuildFile; fileRef = D3B82A0015C18A710036C93E /* history_details_bar_background.png */; };
D3B82A0415C18A710036C93E /* settings_bar_background.png in Resources */ = {isa = PBXBuildFile; fileRef = D3B82A0115C18A710036C93E /* settings_bar_background.png */; };
D3B82A0515C18A710036C93E /* settings_bar_background.png in Resources */ = {isa = PBXBuildFile; fileRef = D3B82A0115C18A710036C93E /* settings_bar_background.png */; };
D3B9A3DF15A58C450096EA4E /* chat_field.png in Resources */ = {isa = PBXBuildFile; fileRef = D3B9A3DA15A58C440096EA4E /* chat_field.png */; };
D3B9A3E115A58C450096EA4E /* chat_ok_default.png in Resources */ = {isa = PBXBuildFile; fileRef = D3B9A3DB15A58C440096EA4E /* chat_ok_default.png */; };
D3B9A3E315A58C450096EA4E /* chat_ok_over.png in Resources */ = {isa = PBXBuildFile; fileRef = D3B9A3DC15A58C440096EA4E /* chat_ok_over.png */; };
@ -1412,6 +1416,8 @@
D3A8BB7815A6CC3200F96BE5 /* setup_back_disabled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = setup_back_disabled.png; path = Resources/setup_back_disabled.png; sourceTree = "<group>"; };
D3A8BB7915A6CC3200F96BE5 /* setup_cancel_disabled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = setup_cancel_disabled.png; path = Resources/setup_cancel_disabled.png; sourceTree = "<group>"; };
D3A8BB7A15A6CC3200F96BE5 /* setup_start_disabled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = setup_start_disabled.png; path = Resources/setup_start_disabled.png; sourceTree = "<group>"; };
D3B82A0015C18A710036C93E /* history_details_bar_background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = history_details_bar_background.png; path = Resources/history_details_bar_background.png; sourceTree = "<group>"; };
D3B82A0115C18A710036C93E /* settings_bar_background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = settings_bar_background.png; path = Resources/settings_bar_background.png; sourceTree = "<group>"; };
D3B9A3DA15A58C440096EA4E /* chat_field.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = chat_field.png; path = Resources/chat_field.png; sourceTree = "<group>"; };
D3B9A3DB15A58C440096EA4E /* chat_ok_default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = chat_ok_default.png; path = Resources/chat_ok_default.png; sourceTree = "<group>"; };
D3B9A3DC15A58C440096EA4E /* chat_ok_over.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = chat_ok_over.png; path = Resources/chat_ok_over.png; sourceTree = "<group>"; };
@ -2343,6 +2349,7 @@
D3157A8915B4466F00DD8C4C /* history_details_add_over.png */,
D3157A8E15B446CB00DD8C4C /* history_details_back_default.png */,
D3157A8F15B446CB00DD8C4C /* history_details_back_over.png */,
D3B82A0015C18A710036C93E /* history_details_bar_background.png */,
D3ED3E9415872EF1006C0DE4 /* history_edit_default.png */,
D3ED3E9515872EF1006C0DE4 /* history_edit_over.png */,
D3ED3E9715872EF1006C0DE4 /* history_missed_default.png */,
@ -2437,6 +2444,7 @@
D3D6A3A5159B0EFE005F692C /* security_ko.png */,
D3D6A3A7159B0EFE005F692C /* security_ok.png */,
D3D6A3A6159B0EFE005F692C /* security_pending.png */,
D3B82A0115C18A710036C93E /* settings_bar_background.png */,
D38327EF1580FE3A00FA0D23 /* settings_default.png */,
D38327FE158100E400FA0D23 /* settings_over.png */,
D38327F01580FE3A00FA0D23 /* settings_selected.png */,
@ -3032,6 +3040,8 @@
D3C31A8215BD8DED008ED271 /* video_on_default_landscape.png in Resources */,
D3C31A8415BD8DED008ED271 /* video_on_disabled_landscape.png in Resources */,
D3C31A8615BD8DED008ED271 /* video_on_over_landscape.png in Resources */,
D3B82A0215C18A710036C93E /* history_details_bar_background.png in Resources */,
D3B82A0415C18A710036C93E /* settings_bar_background.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -3336,6 +3346,8 @@
D34BD74115C13E250070C209 /* Localizable.strings in Resources */,
D34BD74215C13E350070C209 /* untitled.plist in Resources */,
D34BD74315C13ED70070C209 /* DialerViewController.xib in Resources */,
D3B82A0315C18A710036C93E /* history_details_bar_background.png in Resources */,
D3B82A0515C18A710036C93E /* settings_bar_background.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};