Darkseal / DownPicker

A lightweight DropDownList / ComboBox for iOS, written in Objective-C
MIT License
202 stars 93 forks source link

Arrow image not found #33

Open alexandre-g opened 8 years ago

alexandre-g commented 8 years ago

When installed with CocoaPods

Darkseal commented 8 years ago

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,

slxl commented 8 years ago

@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

mkval commented 7 years ago

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.