davdroman / bohr Goto Github PK
View Code? Open in Web Editor NEWSettings screen composing framework
License: MIT License
Settings screen composing framework
License: MIT License
So i have a BOButtonTableViewCell with Turn Passcode On
when the user first open settings.
When the user taps the button a lock view appears where he can enable a passcode for the app.
When the lockview is dismissed and the user has set his desired passcode i want the text of the button to change to Turn Passcode Off
is there any other way to achieve this besides keeping a reference of the cell and changing the title?
i mean just reloading a simple cell
thanks
Trying to use BOChoiceTableViewCell in Swift3 and set optionValues but its throwing a "no member 'optionValues'"?
Hi, The pod installation seems to be missing a significant number of files? Such as BOTableViewSection ?
this is less of an issue, and more of a question about how to use the library, since there isn't much documentation.
I'm using Bohr as a settings page. 3 of the cells are username, name, and email. Another cell is a button cell. The button cell saves the changed data from the other cells to the server. In the button cell, how can I access the text field values of the other cells? For example, in the main tableviewcontroller:
[section addCell:[BOButtonTableViewCell cellWithTitle:@"Save Info" key:nil handler:^(BOButtonTableViewCell *cell) {
cell.actionBlock = ^{
// usernamecell.Textfield.text here
// emailcell.textfield.text here
// API call to save new data to server here
};
}]];
any help would be appreciated, thanks
Hi David,
Thanks for your Bohr,it help me a lot in my project.
But now I have to change the datePicker.datePickerMode=UIDatePickerModeDateAndTime,
When I scroll the datePicker at today,the project will crash and the log is in the following:
*** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]' ***
Can you help me and tell me how to solve this problem?
Thanks a lot.
Does it support adding an icon on the left side of the cell, similar to the iPhone settings ? or should i edit the source code so it supports adding an icon ?
it crashes when using the layoutMargins
is there any solution for apps that still support IOS 7?
thanks
Hi there!
I really love your library, I think there're no resources like this apart from InAppSettingsKit and I really support your job.
I just open the issue to let you know that a big feature to this awesome library would be to support DatePicker. I know this is easily extensible and I'll try to implement this feature after this week of holidays as I need it to my settings view.
Keep It up and I'm really looking forward to your next release!
The setValueDidChangeBlock
method in BOSetting is not exposed in the header file.
I'm wondering how the Model layer can register to be notified for any changes (so without adding itself as a target in the UI layer) ?
to use an image before the text do we need to subclass the cell or just mess with BOTableViewCell.m and add it there?
i used the default imageview of the cell so i added it in the BOTableViewCell.m by adjusting the class method like so:
+ (instancetype)cellWithTitle:(NSString *)title key:(NSString *)key image:(UIImage*)image handler:(void (^)(id cell))handler;
Steps to recreate:
BOTimeTableViewCell
in the Section 2 of demo example.pickerView
Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x7feaa363edb0 H:[UITableViewLabel:0x7feaa3631b90'Text']-(15)-[UITextField:0x7feaa363b070](LTR)>",
"<NSLayoutConstraint:0x7feaa363ee00 UITextField:0x7feaa363b070.right == UITableViewCellContentView:0x7feaa3631a50.rightMargin>",
"<NSAutoresizingMaskLayoutConstraint:0x7feaa37ddfc0 h=--& v=--& UITableViewLabel:0x7feaa3631b90'Text'.midX == + 187.5>",
"<NSAutoresizingMaskLayoutConstraint:0x7feaa37de010 h=--& v=--& H:[UITableViewLabel:0x7feaa3631b90'Text'(343)]>",
"<NSLayoutConstraint:0x7feaa37f3c00 'UIView-Encapsulated-Layout-Width' H:[UITableViewCellContentView:0x7feaa3631a50(375)]>",
"<NSAutoresizingMaskLayoutConstraint:0x7feaa37ef590 h=--& v=--& 'UIView-Encapsulated-Layout-Left' H:|-(0)-[UITableViewCellContentView:0x7feaa3631a50] (Names: '|':BOTextTableViewCell:0x7feaa3631040 )>"
)
This happens when a pickerView
closes and the BOTimeTableViewCell
has been dequeued. So when the TableView
creates it again it throws the above error.
Is swift supported and if so.. How do I go about using this control in my project? Could you update the "Read Me" or just answer here in this issue?
Hello,
How to change the font of sections and cells ?
I create a BOButtonTableViewCell
and set destinationViewController
for it, but after go the destination view controller and then go back to Bohr controller, the item's title disappears!
[section addCell:[BOButtonTableViewCell cellWithTitle:@"Sample Text" key:nil handler:^(BOButtonTableViewCell *cell) {
cell.mainFont = [UIFont fontWithName:FONT_MAIN size:18];
SampleViewController *dvc = [[SampleViewController alloc] init];
cell.destinationViewController = dvc;
}]];
Before:
<img width="321"src="https://cloud.githubusercontent.com/assets/611607/13378298/30b7de66-de17-11e5-87cf-2e8b3148a30f.png">
How to solve this issue?
Hello and thanks for this great library.
I was wondering if there is a way to know when a user changes a value in an BOChoiceTableViewCell
cell. I haven't subclassed the cell so i am using the demo for now.
So i want to be able to do something when i user changes his choice in the cell.
can you help?
thanks
Common thing on settings screens - to show version and build number in footer. This can't be done from storyboard, only in runtime, so I want property like defaultFooterTitle
. It even can be configured for each section. So priorities for section footers will be: 1) storyboard 2) default from property 3) cells dynamic footers.
Thanks!
Hi!
How can i add my own subclass so i can have a uislider inside the cell?
I've tried with the following code, but it seems like the constrains are messing it up.
self.slider = [UISlider new];
//frame for the slider
//create and initialize the slider
self.slider = [[UISlider alloc] init];
//set the minimum value
self.slider.minimumValue = 100.0f;
//set the maximum value
self.slider.maximumValue = 2000.0f;
//set the initial value
self.slider.backgroundColor = [UIColor blackColor];
[self.slider addTarget:self action:@selector(toggleSwitchValueDidChange) forControlEvents:UIControlEventValueChanged];
[self.contentView addSubview:self.slider];
NSLayoutConstraint *centerYConstraint = [NSLayoutConstraint constraintWithItem:self.slider attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.slider.superview attribute:NSLayoutAttributeCenterY multiplier:1 constant:0];
NSLayoutConstraint *rightConstraint = [NSLayoutConstraint constraintWithItem:self.slider attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.slider.superview attribute:NSLayoutAttributeRightMargin multiplier:1 constant:0];
self.slider.translatesAutoresizingMaskIntoConstraints = NO;
[self.slider.superview addConstraints:@[centerYConstraint, rightConstraint]];
For example a BOButtonTableViewCell that is used to initiate an IAP.
While building with Xcode 8.3.2, following compiler warning is received:
.../Pods/Bohr/Bohr/BOTableViewController.m:54:1: Method possibly missing a [super awakeFromNib] call
in the demo project i added the following line between the 2 switches in the 1st section:
[section addCell:[BOStepperTableViewCell cellWithTitle:@"Stepper" key:@"stepper" handler:nil]];
Now if you try to change value of the 1st switch there is a small animation issue while the tableview is trying to animate switch 2 into the view.
Same goes if i put the stepper as the 1st cell. if however i put the stepper as the 3rd cell (last one of 1st section) the animation works fine
Hi there!
I'm working now with your library and I've come with a feature that could be an extension for BOTextViewCell which only accepts int numbers or decimal numbers on it. Do you think is viable? Or it's reachable with the current library?
Regards!
when testing the latest version it fails to work as the BOStepperTableViewCell header file is missing from the public headers in the Bohr framework target.
adding it makes everything work just fine 👍
plus it would a good idea to add it to the demo too :)
I think this file is in the project by mistake BOTableViewCell (MacBook Pro de David's conflicted copy 2015-08-26).h
It produces an error when you try to execute the app (Duplicate interface definition) using cocoapods. Should be fixed once is removed.
Bohr started out without any storyboard support whatsoever until it was introduced in version 2. The thing is IB isn't quite ready to support IBDesignable
cells inside its UITableViewController
s (and doesn't look like it will anytime soon). Besides, there have been some reported issues about resizing and autolayout that I found are related to storyboard being the way to set up the table view controller.
The only advantage storyboard support adds is IBInspectable
s, but without IBDesignable
support this looses great part of its importance.
This advantage vs. all the other disadvantages drive me to think I should drop storyboard support as part of a version 3 release. That way, the whole setup process would be made in a same place (setup
method of your BOTableViewController
subclass) and would allow for issues like #8 to be fixed.
What's your opinion on this? Is storyboard a must-have for Bohr or would you be just fine setting it up programmatically? I feel like it would bring many benefits.
// AppDelegate.m
[[NSUserDefaults standardUserDefaults] registerDefaults:@{
@"settings.language": @0,
}];
// SettingsTableViewController.m
[self addSection:[BOTableViewSection sectionWithHeaderTitle:DPLocalizedString(@"settings.navbar.title", nil) handler:^(BOTableViewSection *section) {
[section addCell:[BOChoiceTableViewCell cellWithTitle:DPLocalizedString(@"settings.table.language", nil) key:@"settings.language" handler:^(BOChoiceTableViewCell *cell) {
cell.options = @[@"English", @"Swedish", @"Russian", @"Uzbek"];
cell.destinationViewController = [LanguageSettingsViewController new];
}]];
}]];
// LanguageSettingsViewController.m
- (void)setup {
self.title = DPLocalizedString(@"settings.table.language", nil);
[self addSection:[BOTableViewSection sectionWithHeaderTitle:DPLocalizedString(@"settings.table.language", nil) handler:^(BOTableViewSection *section) {
[section addCell:[BOOptionTableViewCell cellWithTitle:@"English" key:@"settings.language" handler:nil]];
[section addCell:[BOOptionTableViewCell cellWithTitle:@"Swedish" key:@"settings.language" handler:nil]];
[section addCell:[BOOptionTableViewCell cellWithTitle:@"Russian" key:@"settings.language" handler:nil]];
[section addCell:[BOOptionTableViewCell cellWithTitle:@"Uzbek" key:@"settings.language" handler:nil]];
}]];
}
It displays LanguageSettingsViewController but nothing happens when I select any of the options.
I set the property for a variable with numberOfDecimals = 2, however I can type or enter the big number: 10,0000. It is still okay. Is this a bug?
Use case:
on
uncovers one more option below: "URL"I have some ideas how implement that in a nice way, now I have a flag in my viewController:
if (self.flag) {
[section addCell:[BODateTableViewCell cellWithTitle:@"url" key:@"url" handler:nil]];
}
rebuilding list is done by:
[self setup];
[self.tableView reloadData];
I have some ideas how to do it in more declarative way, and ready to discuss them if you think it's worthy to have this feature.
When I set a footerTitleFont (eg section.footerTitleFont = UIFont(name: "Avenir-Book", size: 9)
), that font is not taken into account (here. This is particularly noticeable when you have a string which is a different number of lines with the applied font vs the default font. Example:
I made some changes in a fork to take the font into consideration, but I don't really like having to assume the padding around the textLabel (observed to be 16 on the left and right and 7 on the top and bottom). I'll have a think about how to remove that without making things too complicated, though perhaps you have a better idea.
Update cocoapods to 1.1.1 and
pod 'Bohr', '3.0.0'
Bohr will have path issues.
need to remove subdirectory Bohr and use quotes
#import "BOTableViewController.h"
Hello!
Could you please explain how to use text field input error block. Which event should perform it?
Hi David!
I have used your component, it's awesome!! I have a question I use it for create a calendar event, user can select one or multiple valid days for his event, at this point I subclassed BOTableViewController and works perfectly! but at the moment of edition I cannot found a way to "preload" multiple previous selections.
I used BOOptionTableViewCell and wrote in handler:
cell.accessoryType = UITableViewCellAccessoryCheckmark;
for each cell that I want to be marked but it doesn't work
Any ideas?
Thanks in advance!
If I'm storing my settings on some external server, I'd love to have a way to monitor their changes. Right now I'm doing it in the .visibilityBlock
, with the key set to the field's key:
[section addCell:[BOSwitchTableViewCell cellWithTitle:@"Push Notifications" key:@"push_notif" handler:^(BOSwitchTableViewCell *cell) {
cell.visibilityKey = @"push_notif";
cell.visibilityBlock = ^BOOL (id settingValue ){
[self setPushTo:[settingValue boolValue]];
return YES;
};
}]];
but I doubt this is the preferred way to handle it.
With BOButtonTableViewCell
I have an access to the .actionBlock
, but with other cell types it's not there, even it could be useful.
When I try to add a BOSwitchTableViewCell
and set the on
property in the handler to true, it doesn't work.
In order to change the background and font colors of a section I need to use this workaround:
- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section{
// Background color
view.tintColor = [UIColor blackColor];
UITableViewHeaderFooterView *header = (UITableViewHeaderFooterView *)view;
[header.textLabel setTextColor:[UIColor whiteColor]];
}
It should be handled by the appearance proxy.
Thanks for providing Bohr. It's been very helpful!
I'm having one issue. Here are the steps producing the crash:
#import "UILabel+DatePickerCustomization.h"
// line 85
- (void)bo_setFont:(UIFont *)font {
.... [self bo_setFont:font] ;
}
After presenting a keyboard for textfield the only way to hide it - click Done
button. If I click other cells or even go through navigation controller keyboard still persists on screen. Personally I want to hide it on interaction with other cells or even with tap on tableview background.
This can be optional configurable behaviour.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.