iosrubyrubymotionrubymotion-promotion

iOS RubyMotion Promotion Webscreen Freeze


I am getting a freeze in my app(which is a ruby motion IOS app) on a drop down click inside a web screen.

def thing
 open_modal WebScreen.new(
  name: "Thing",
  url: testURL,
  nav_bar: true,
  modal: true,
  transition_style: UIModalTransitionStyleFlipHorizontal)
end

app gets frozen on something like this. The user here clicks the SelectCategory button and now can't do anything. https://i.sstatic.net/FpZQ3.png

My console outputs this:
Mar 11 14:59:33: CoreAnimation: timed out fence c413
Mar 11 14:59:33: CoreAnimation: updates deferred for too long

Here is my web screen class:

class WebScreen < PM::WebScreen
  # status_bar :none
  attr_accessor :url, :name, :id, :thing, :loading

 def on_init
  self.loading = 0
  nav_bar
end

def on_load
  # find.screen.webview.scalesPageToFit = true
  self.title = @name? @name.upcase : "Thing"
  @notifier = Motion::Blitz
end

def content
 NSURL.URLWithString(@url)
end

def load_started
  if self.loading <= 1
   @notifier.loading
   self.loading += 1
  end
end

def load_finished
  @notifier.dismiss
end

def load_failed(error)
 # Optional
 # "error" is an instance of NSError
end

def shut_screen
 @notifier.dismiss
 close({ no_load: true, id: self.id })
end

def nav_bar
  unless self.coupon
   icon = FIEntypoIcon.chevronThinLeftIcon
   icon_image = icon.imageWithBounds([[0, 0], [20, 20]], color:     UIColor.whiteColor)
  set_nav_bar_button :left, image: icon_image, action: :shut_screen
  else
   set_nav_bar_button :left, title: "Done", style: :plain, action: :close_coupon
  end
end

 def close_coupon
rmq.app.alert(title: *, message: "Thing will disappear. Please make sure      you've used the thing before closing.", actions: :yes_no_cancel, style: :sheet) do |action_type|
  case action_type
  when :yes
    shut_screen
  when :no
    puts "FINE!"
  end
end
end

def back
 find.screen.close to_screen: :root
end
end

Any info is greatly appreciated.


Solution

  • So finally figured it out. Not sure why but when you set a UITableView backgroundview with an image it freezes the web view when it trys to open a drop down. So dont know how to solve but I just set the UITableView background color and that seems to have stopped the freezing