futuretap / InAppSettingsKit

This iOS framework allows settings to be in-app in addition to or instead of being in the Settings app.
https://www.futuretap.com/blog/inappsettingskit-3-0
Other
3.18k stars 546 forks source link

Now you can set the tintColor of 'Done' Button #119

Closed umpire274 closed 12 years ago

umpire274 commented 12 years ago

If you want to use a different color than the default, now you can.

Use the next syntax:

self.appSettingsViewController.doneButtonColor = [UIColor colorWithRed:114.f/255.f green:158.f/255.f blue:111.f/255.f alpha:1.f];

and you have your 'Done' button with your favorite tint.

See the changes needed in my fork https://github.com/umpire274/InAppSettingsKit

diederich commented 12 years ago

see #93 for a comment

umpire274 commented 12 years ago

In my fork I've made a change to put the capability of set the tintColor of 'Done' button. But I don't know if you have saw the change in my source code.

umpire274 commented 12 years ago

Sorry Stephan..

Here in attach you have the code with my changes to customize the Done button or simply to change the tintColor.

Verify if this useful to integrate in your framework.

BR, Alex.

On 12/dic/2011, at 19:08, Stephan Diederich wrote:

see #93 for a comment


Reply to this email directly or view it on GitHub: https://github.com/futuretap/InAppSettingsKit/issues/119#issuecomment-3109855

diederich commented 12 years ago

Hey Alex,

thanks for the comment. It seems your InAppSettingsKit fork has vanished, what happened?

p.s.: I'm just another user of InAppSettingsKit and try to contribute :)

umpire274 commented 12 years ago

Hi Stephan and all of you.

I've restored my fork. With my solution is possible to have a custom 'Done' button or change only the tintColor.

See #125 for more information.

This issue is close

markrickert commented 12 years ago

@umpire274 Why don't you just subclass the IASK View controller? Then you can basically do whatever you want to it instead of hacking at the library. I've changed colors, added custom graphical footers, etc, all without touching IASK.

umpire274 commented 12 years ago

@markrickert Sorry for the inconvenience. I thought that my change was important for all developers who utilize this framework, from beginners to experts. I am a beginner and I'm trying to learn as many things as possible and I thought that my contribution was as important as yours. Surely I will do as you say that I learned something new. I apologize for my response offended.

markrickert commented 12 years ago

No inconvenience/offense at all. Here's some code so you can begin learning to subclass the IASK library. I'm using it inside of a UITabBarController as a tab.

I initialize the settings view in my own UINavigationController subclass where i set my titlebar's tintcolor manually, which the UIBarButtonItem elements always inherit.

Here's an example implementation of my IASKAppSettingsViewController subclass and a delegate class.

SettingsView.h

#import "IASKAppSettingsViewController.h"

@class IASKSettingsReader;
@class SettingsDelegate;

@interface SettingsView : IASKAppSettingsViewController

@property (nonatomic, strong) SettingsDelegate *sd;

@end

SettingsView.m

#import "SettingsView.h"
#import "SettingsDelegate.h"

@implementation SettingsView

@synthesize sd = _sd;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self.title = @"Settings";
    self.tabBarItem.image = [UIImage imageNamed:@"settings"];
    return [super initWithNibName:@"IASKAppSettingsView" bundle:nibBundleOrNil];
}

-(void) viewDidLoad
{
    [super viewDidLoad];

    //Set a background color
    self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background"]];
    //Don't show the done button
    self.showDoneButton = NO;

    //Set a delegate    
    _sd = [[SettingsDelegate alloc] init];
    self.delegate = _sd;

    //Set up the footer.
    if([self.file isEqualToString:@"Root"]) //This determines if it's at the root view of IASK
    {
        UIView *footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 30, 250, 110)];
        UIImageView *footerLogo = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"MyLogo.png"]];
        footerLogo.frame = CGRectMake(0, 20, 250, 80);
        footerLogo.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;

        [footerView addSubview:footerLogo];
        self.tableView.tableFooterView = footerView;    
    }
}

@end

SettingsDelegate.h

#import "IASKAppSettingsViewController.h"

@interface SettingsDelegate : NSObject <IASKSettingsDelegate>

@end

SettingsDelegate.m

#import "SettingsDelegate.h"

@implementation SettingsDelegate

- (void)settingsViewControllerDidEnd:(IASKAppSettingsViewController*)sender
{
    NSLog(@"Closed Settings View");
}

- (void)settingsViewController:(IASKAppSettingsViewController*)sender buttonTappedForKey:(NSString*)key
{
    NSLog(@"Got button press: %@", key);
}

//Other delegate methods

@end

Hope that helps you out.