快速連結

2013年11月24日

iOS螢幕旋轉觸發自定義function (xcode 5)

資料來源與參考:官方:Supporting Multiple Interface Orientations

iOS6之前使用的旋轉函式已經無法使用了,而是使用-(NSUInteger)supportedInterfaceOrientations-(BOOL)shouldAutorotate來配合旋轉。
但是如果在旋轉後要呼叫自定程序去處理自定界面呢?

2013年11月21日

進入XCode 5時代後,怎麼無法Archive

好不容易生成Provisioning Profile檔案,試著Archive,卻發生報錯:
Code Sign error: No matching provisioning profile found: Your build settings specify a provisioning profile with the UUID “XXXX”, however, no such provisioning profile was found.
CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 7.0'
有兩個解決方案:
Provisioning Profile的設定更正
或是
使用文本編輯器修改xcodeproj檔案

2013年8月5日

讓另一個自定義ViewGoup物件能夠添加且顯示在自定義ViewGroup內

標題寫的很複雜,簡單來說就是──

我有一個自定義ViewGroup物件,稱為父親,要加入孩子,這孩子也是另外一個自定義ViewGroup物件。
雖然能夠成功addView進孩子,但是孩子卻羞澀的硬是不顯示出來。
──這不是孩子太過於害羞的問題!
而是你少告訴他你長多高多寬!

記得要在子自定義ViewGroup物件內的建構子中,加上:

this.setMinimumWidth(100);
this.setMinimumHeight(100);

2013年7月22日

背景圖無限重複祕技

使用以下圖片,拼成滿版背景的方法

在APP內拼成花花的背景:


2013年7月10日

讓你的View動起來──新版本

在4.0之前,讓View動作的語法如下:

    UIButton *button = [[UIButton alloc] init];
    CGRect frame = button.frame;
    frame.origin.x = 500; // new x coordinate
    frame.origin.y = 500; // new y coordinate

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration: 0.25];
    button.frame = frame;
    button.alpha = 0;
    [UIView commitAnimations];

2013年5月21日

對每個child作class確認

以下是程式碼:

for (var i:uint = 0; i < this.numChildren;i++){
  var child = this.getChildAt(i);
  if (child is SimpleButton){
     trace(child,"is SimpleButton");
  }
}

2013年3月2日

取得網址的參數


$.urlParam = function(name){
 var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
 if (!results) { return 0; }
 return results[1] || 0;
}


來源:Get URL Parameters with jQuery | Improved

2013年2月26日

改‧TouchImageView

原本我使用的版本找不到了,類似的在此:Pinching Zoom in android Image View or Bitmap
另外一個的版本則是這個:MikeOrtiz / TouchImageView
WrapMotionEvent與EclairMotionEvent程式碼我就沒有放上來了,直接到第一個連結複製即可。
我這裡參考許多文章,在TouchImageView.java內增加了放大縮小、邊界判定。

2013年2月23日

讓ViewGroup建立實體物件

當想要建立ViewGroup物件時,卻發現不能用ViewGroup直接建立物件,因為他是abstract(抽象)類型,必須要再建立一個實體類別去繼承ViewGroup。
實體類別的程式碼下收: