2013-04-11 57 views
0

爲什麼tabbar不會在iPhone4或5上自動加載「@ 2x」圖像? 這裏是我的代碼:Corona SDK:TabBar不會加載@ 2x圖像..?

local function init() 
--Create a group that contains the entire screen and tab bar 
mainView = display.newGroup() 

--Create a group that contains the screens beneath the tab bar 
tabView = display.newGroup()  
mainView:insert(tabView) 

loadScreen("info-moregames") 

tabBar = viewController.newTabBar{ 
     background = "UI_INFO/tabBar.png", --tab bar background 
     default = {"UI_INFO/pogi_no.png","UI_INFO/noads_no.png","UI_INFO/share_no.png","UI_INFO/star_no.png","UI_INFO/restore_no.png","UI_INFO/back_no.png"}, 
     over = {"UI_INFO/pogi_yes.png","UI_INFO/noads_yes.png","UI_INFO/share_yes.png","UI_INFO/star_yes.png","UI_INFO/restore_yes.png","UI_INFO/back_yes.png"}, 
     tabs = {"More", "No Ads", "Share","Rate us","Restore","back"}, --names to appear under each tab icon 
     onRelease = showScreen --function to execute when pressed 
    } 
mainView:insert(tabBar) 

tabBar.selected() 

return true 

回答

0

如果你有一個像上面一個config.lua文件,您的圖像將automaticaly縮放。

application = { 
    content = { 
     width = ***, 
     height = ***, 
     scale = "letterBox", 
} 

如果您有像上面這樣的config.lua文件,您可以針對不同的分辨率使用不同的圖像。請注意,你應該有兩個圖像。例如,你有一個20x20的image temp.png。那麼你應該有另一個[email protected],它是40x40。通過這種方式,您可以獲得更好的分辨率更高的圖像。此外,1.5值意味着如果設備的屏幕比您想要的分辨率多出1.5倍,請使用@ 2x結尾的圖像。

application = { 
    content = { 
     width = ***, 
     height = ***, 
     scale = "letterBox", 

     imageSuffix = { 
      ["@2x"] = 1.5, 
     } 
    }, 
} 
+0

那麼應該輸入什麼樣的'寬度'和'高度'? – RRN 2013-04-11 10:45:14

+0

這取決於你..如果你正在創建一個iPhone應用程序,你可以設置 width = 320,height = 480,or width = 640,height = 960 – 2013-04-11 11:19:40

+0

我檢查過了,我想我已經做過了。它適用於其他圖像,但不適用於TabBar。 – RRN 2013-04-11 11:33:25