infinitered / redpotion

We believe iPhone development should be clean, scalable, and fast with a language that developers not only enjoy, but actively choose. With the advent of Ruby for iPhone development the RubyMotion community has combined and tested the most active and powerful gems into a single package called RedPotion
MIT License
233 stars 40 forks source link

Unable to add remote image to nav_bar button #165

Closed augustosamame closed 8 years ago

augustosamame commented 8 years ago

Hello. My nav_bar should show the logged_in user's picture on the right and clicking on it should open a Profile screen.

It works fine with a new user that has not uploaded a profile picture yet, and therefore It's using a local placeholder image, but when Auth.current_user["image"] contains an URL pointing to the user's profile image, it no longer works.

image_view = UIImageView.alloc.initWithFrame(CGRectMake(0, 0, 50, 50))
image_view.contentMode = UIViewContentModeScaleAspectFit
image_view.setImageWithURL(Auth.current_user["image"])

set_nav_bar_button :right,
  image: Auth.current_user["image"].nil? ? image.resource("icon_user_50x50.png") : image_view,
  action: :open_profile

But when a remote image exists, this code does not work properly. It shows the image, but nothing happens when it is tapped / clicked.

If I exchange this line:

image: Auth.current_user["image"].nil? ? image.resource("icon_user_50x50.png") : image_view,

for this one:

image: Auth.current_user["image"].nil? ? image.resource("icon_user_50x50.png") : image.from_view(image_view),

tapping / clicking works, but no image is shown.

Any help would be appreciated.

jamonholmgren commented 8 years ago

Fixed via https://github.com/infinitered/ProMotion/issues/789#issuecomment-234569620.