Hi,
when working with DDExpandableButton (which is a great entrypoint by the way) I stumbled upon the non-obvious behaviour when you only want to present an image with toggleMode:YES and no "buttons". This is interesting if all you want to show is the image in leftTitle.
First of all, initWithPoint:leftTitle:buttons: can't handle either nil or an empty NSArray as input for buttons. A quick fix would be
in setButtons: before adding to _labels.
But the tricky part only comes then :-) With a @"" as button and a normal 20x20 image in leftTitle, the whole DDExpendableButton is suddenly only 20 pixels in width total. The only way I found visually pleasing working was to quickly whip up an empty view with a width of 18px like so:
@interface EmptyView : UIView
+ (id)emptyView;
@end
@implementation EmptyView
- (CGSize)defaultFrameSize
{
return self.bounds.size;
}
- (CGFloat)defaultFrameWidth
{
return CGRectGetWidth(self.bounds);
}
- (id)init
{
return [self initWithFrame:CGRectZero];
}
+ (id)emptyView
{
return [[self alloc] init];
}
@end
Hi,
when working with DDExpandableButton (which is a great entrypoint by the way) I stumbled upon the non-obvious behaviour when you only want to present an image with
toggleMode:YESand no "buttons". This is interesting if all you want to show is the image in leftTitle.First of all,
initWithPoint:leftTitle:buttons:can't handle eithernilor an emptyNSArrayas input forbuttons. A quick fix would bein
setButtons:before adding to _labels.But the tricky part only comes then :-) With a
@""as button and a normal 20x20 image inleftTitle, the whole DDExpendableButton is suddenly only 20 pixels in width total. The only way I foundvisually pleasingworking was to quickly whip up an empty view with a width of 18px like so: