DownPicker
DownPicker copied to clipboard
Arrow image not found
When installed with CocoaPods
Hello, I just tried installing 0.1.34 in a sample project using CocoaPods and I got the arrow image showing.
Chances are you're using a different version?
I would also try setting [showArrowImage:YES] during your view's init.
Check also this issue: https://github.com/Darkseal/DownPicker/issues/15
Let me know,
@Darkseal the problem is with hard coded bundle name. When use_frameworks! option is set at the Podfile - you won't have that bundle, but framework instead
I agree with @slxl. I'm using it for a Swift2 project. Pod version is 0.1.34.
Inside DownPicker init
, it tries to load a bundled downArrow.png
image, and only when it's available, such UIImageView instance is passed to the textField.rightView
.
// setup the arrow image
UIImage* img = [UIImage imageNamed:@"downArrow.png"]; // non-CocoaPods
if (img == nil) img = [UIImage imageNamed:@"DownPicker.bundle/downArrow.png"]; // CocoaPods
if (img != nil) self->textField.rightView = [[UIImageView alloc] initWithImage:img];
self->textField.rightView.contentMode = UIViewContentModeScaleAspectFit;
self->textField.rightView.clipsToBounds = YES;
The problem is, if there was no UIImageView instance attached to the textField
, calling setArrowImage:
method doesn't do anything.
-(void) setArrowImage:(UIImage*)image
{
[(UIImageView*)self->textField.rightView setImage:image];
}
What i'm doing now to circumvent this is to create a UIImageView instance, which already holds my custom down arrow, and pass it to my textField
's rightView
property before instantiating a DownPicker object.