davdroman / Bohr

Settings screen composing framework
MIT License
1.26k stars 83 forks source link

Support for long cell titles #8

Closed Davvie closed 8 years ago

Davvie commented 9 years ago

Bohr is great. But with the support (automatic resizing) of long cell titles it would become even better.

2015-07-17 14 43 33

davdroman commented 9 years ago

That is definitely on my checklist. The thing is it's pretty tricky due to some Autolayout needs in certain cells. But yeah, I'm on working on it :)

davdroman commented 9 years ago

So I've been trying to make it work but seems like storyboard's UITableViewControllers aren't quite ready for this kind of business.

I'll keep trying, but the idea of dropping storyboard support and make it all programmatic is growing in me. It's just much cleaner + allows for this kind of stuff.

What's your opinion on this?

Davvie commented 9 years ago

Sorry for a late reply.

I believe you're right. Dropping storyboard support indeed gives more freedom.

There is a nice example of using a programmatic approach in a similar field. For instance, here's the way you can describe form fields in FXForms:

- (NSArray *)fields
{
    return @[
             @{FXFormFieldKey: @"email", FXFormFieldTitle: @"Email Address"},
             ...other fields...
            ];
}

I guess Bohr could benefit from using a similar approach by describing settings in code.

davdroman commented 9 years ago

Good to hear your thoughts about this. I'll start working on v3 then :)

davdroman commented 9 years ago

Hey there @Davvie!

I just pushed v3.0.0 alpha 1 and I'd like it if you gave it a try. I'm pretty positive this bug is now gone since the nasty Autolayout hack is now longer necessary :)

Davvie commented 9 years ago

Great to hear version 3 is out!

I tried to set it up but it doesn't seem to work at all :(

1

I guess, you've dropped Storyboard support. So I tried to do everything in code but I'm surely doing something wrong.

I've got a view controller which is a subclass of BOTableViewController. It is assigned to a storyboard scene.

The first and major problem is that setup() is never called.

That's how I tried to add settings to Bohr:

BOTableViewSection *basicSettings = [[BOTableViewSection alloc] init];
    BOSwitchTableViewCell *autoLoginCell = [[BOSwitchTableViewCell alloc] init];
    autoLoginCell.textLabel.text = @"Automatic login";
    autoLoginCell.key = @"Settings_AutoLogin";
    BOSwitchTableViewCell *episodePriorityCell = [[BOSwitchTableViewCell alloc] init];
    episodePriorityCell.textLabel.text = @"Show new episodes first";
    episodePriorityCell.key = @"Settings_NewOnTop";
    [basicSettings addCell:autoLoginCell];
    [basicSettings addCell:episodePriorityCell];
    [self addSection:basicSettings];
davdroman commented 9 years ago

Yeah storyboard support is completely dropped, meaning not even assigning a subclass to a UITableViewController in a storyboard will work. I could include that little feature in next alpha if storyboards are really that mandatory.

Please try running the demo project on Xcode 7 :)

Davvie commented 9 years ago

Aaah, I see. Well, in my current app I have a few buttons that initiate a storyboard segue. So having this little feature would be handy for me to migrate from v2 to v3 :)

But I think in my future projects I will anyway do everything settings-related just in code so it will be more extensible in the long run. Plus, sometimes it takes forever for Xcode to launch Interface Builder if the storyboard is complex.

I'm going to install Xcode 7 tomorrow, so I'll write back once I try it out :ok_hand:

davdroman commented 9 years ago

I'll gladly implement it for alpha 2 then :smile:

davdroman commented 9 years ago

Hey! I just released alpha 2. BOTableViewController should now be attachable as a class to storyboards' UITableViewControllers.

Davvie commented 9 years ago

Yay! Thank you for the Storyboard support, I've just moved to v3, so far so great :)

While running the demo project in Xcode 7 I encountered a few runtime error messages in the console:

Aug 29 16:47:39 BohrDemo[50912] <Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable. Aug 29 16:47:39 BohrDemo[50912] <Error>: CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable. Aug 29 16:47:39 BohrDemo[50912] <Error>: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

screen shot 2015-08-29 at 16 52 29

but the demo app itself works perfectly fine.

davdroman commented 9 years ago

Hmm, that simulator screen is pretty weird. The text cell and footer title's font are bigger than they should be. Was it you who modified such values or is it a bug?

Davvie commented 9 years ago

Oh, it does look weird. Haven't noticed it when I first took the screenshot.

No, I didn't change anything code-wise, just ran the project as it is.

davdroman commented 9 years ago

Ok we have a few problems then. Let me install Xcode 7 myself and check out what's happening.

davdroman commented 9 years ago

I've checked it out and seems like the problem with the text cell isn't ocurring for me, although footers are indeed displayed with a huge font size too. I'll work on that.

Do you see the text cell with the height displayed on the screenshot right when opening the app, or is it reproducible?

Davvie commented 9 years ago

Just tried again, I can't seem to reproduce it. Tapped at all possible buttons and switches but everything's okay anyway.

Btw, noticed one minor issue while running in my current app (with Storyboard). If you start scrolling or changing settings the cells begin to resize (sometimes quite noticeably). But it happens only once.

Davvie commented 9 years ago

Seems like there are some other iOS 9-related problems. Here's what happened when I tried to run my app: https://vid.me/Qx57

davdroman commented 9 years ago

Alpha 4 is now up. Check it out. I think layout issues must be mostly gone :smile:

Davvie commented 9 years ago

Great! Thank you, now I don't experience any layout issues at all :)

davdroman commented 8 years ago

Cool! I'm closing this now :tada:

Let me know if you run into any other issue.