標籤:style blog http io os ar 使用 java sp
目錄:http://blog.csdn.net/wide288/article/details/40298693
怎麼開始開發基礎的 widget
怎麼使用 HTML 和 CSS 取得 widget 的形狀
怎麼使用 javascript 到你的 widget
從 html 開始
這裡的項目是個天氣地圖。每個項目開始的點不一樣,不過要先列出此 widget 的特性。
特性列表:
它應該有地圖雷達,顯示一塊地區。
它應該有當前的臨時地圖。
它應該有昨天的臨時地圖。
它應該有明天的臨時地圖。
地圖是可以調整大小的。
添加背景
<img src=”Default.png”>
建立 widget 結構的 CSS
body {
margin: 0;
}
#mapImage {
position: absolute;
top: 55px;
left: 16px;
}
.backgroundImage {
position: absolute;
top: 0px;
left: 0px;
}
引用方式
<style type=”text/css”>
@import “weathermaps.css”;
</style>
添加菜單
它怎麼工作
用 JS 寫 onclick 事件響應。改變圖片引用內容。
建立 widget
建立 Info.plist
<?xml version=”1.0” encoding=”UTF-8”?>
<!DOCTYPE plist PUBLIC “-//Apple Computer//DTD PLIST 1.0//EN”
“http://www.apple.com/DTDs/PropertyList-1.0.dtd”>
<plist version=”1.0”>
<dict>
<key>AllowNetworkAccess</key>
<true/>
<key>CFBundleDisplayName</key>
<string>WeatherMaps</string>
<key>CFBundleIdentifier</key>
<string>com.apple.widget.weathermaps</string>
<key>CFBundleName</key>
<string>WeatherMaps</string>
<key>CFBundleShortVersionString</key>
<string>.04</string>
<key>CFBundleVersion</key>
<string>.04</string>
<key>CloseBoxInsetX</key>
<integer>12</integer>
<key>CloseBoxInsetY</key>
<integer>12</integer>
<key>MainHTML</key>
<string>weathermaps.html</string>
</dict>
</plist>
建立項目的表徵圖
Icon.png
改檔案夾名稱
雙擊安裝。
確認它是工作的,安裝後測試一下。
開始開發 Dashboard Widgets,第四章,讀書筆記