DownPicker icon indicating copy to clipboard operation
DownPicker copied to clipboard

Arrow image not found

Open alexandre-g opened this issue 8 years ago • 3 comments

When installed with CocoaPods

alexandre-g avatar Dec 02 '15 09:12 alexandre-g

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 avatar Dec 14 '15 18:12 Darkseal

@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

slxl avatar May 01 '16 18:05 slxl

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.

mkval avatar Sep 13 '16 03:09 mkval