2013-06-30 101 views
0

嘗試耙動我正在處理的項目時出現以下錯誤,我無法弄清楚原因。無論我發送了什麼變量,都會發生這個消息。使用setTranslucent時出現RubyMotion錯誤

Objective-C stub for message `setTranslucent:' type `[email protected]:c' not precompiled. Make sure you properly link with the framework or library that defines this message 

這是我的app_delegate文件以供參考。

class AppDelegate 

def application(application, didFinishLaunchingWithOptions:launchOptions) 
    navigation_appearance 
    @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds) 
    tableView = StopsController.alloc.init 
    @window.rootViewController = UINavigationController.alloc.initWithRootViewController(tableView) 
    @window.makeKeyAndVisible 
    true 
end 


def navigation_appearance 
    UINavigationBar.appearance.setBackgroundImage UIImage.imageNamed('navbar_bg.png'), 
    forBarMetrics: UIBarMetricsDefault 
    UINavigationBar.appearance.setTranslucent(true) 
    UINavigationBar.appearance.setShadowImage UIImage.imageNamed('navbar_shadow.png') 
end 

end 

回答

0

看起來你不是要設置在UINavigationBar的一個實例的屬性 -

class AppDelegate 

def application(application, didFinishLaunchingWithOptions:launchOptions) 
    @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds) 
    tableView = StopsController.alloc.init 
    @navigationController = UINavigationController.alloc.initWithRootViewController(tableView) 
    @window.rootViewController = @navigationController 
    navigation_appearance 
    @window.makeKeyAndVisible 
    true 
end 


def navigation_appearance 
    @navigationController.navigationBar.setBackgroundImage UIImage.imageNamed('navbar_bg.png'), 
    forBarMetrics: UIBarMetricsDefault 
    @navigationController.navigationBar.setTranslucent(true) 
    @navigationController.navigationBar.setShadowImage UIImage.imageNamed('navbar_shadow.png') 
end 

end 

應該努力!