May 2009 Archives

為UITableViewCell增加背景圖片

| No Comments | No TrackBacks
雖然不是很了不起的知識, 但也是我找了許久終於找到的答案. 

要使UITableViewCell的背景換成自己喜歡的, 很簡單...

 
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
        static NSString *CellIdentifier = @"Cell";
    
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

        if (cell == nil) {
            cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"background.png"]];// 套用自己的圖片做為背景
            CGRect CellFrame = CGRectMake(0, 0, 300, 60);
        CGRect Label1Frame = CGRectMake(10, 5, 288, 38);
   UILabel *lblTemp;
   UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:CellFrame reuseIdentifier:cellIdentifier] autorelease];
   lblTemp = [[UILabel alloc] initWithFrame:Label2Frame];
   lblTemp.backgroundColor = [UIColor clearColor];//清除預設的背景顏色
   lblTemp.tag = 1;
   lblTemp.font = [UIFont boldSystemFontOfSize:15];
   lblTemp.numberOfLines = 2;
   [cell.contentView addSubview:lblTemp];
   [lblTemp release];
        }

UILabel *lblTemp1 = (UILabel *)[cell viewWithTag:1];
lblTemp1.text = @"AAAAA";
        return cell;
}
  1. 進入OS之後, VirtualBox Windows 的Menu, Device->Install Guest Additions

  2. 在Kubuntu裡會看到已經自動將Gues Additions mount 成CDROM了.

  3. 打開terminal (KDE->Application->System->Terminal)

  4. 輸入 cd /media/cdrom0

  5. Intel 處理器, 請輸入 sudo sh ./VBoxLinuxAdditions-x86.run 或者;

  6. AMD處理器, 請輸入 sudo sh ./VboxLinuxAdditions-amd64.run

  7. 開始安裝...

如何在VitualBox 的OS 設置寬螢幕?

| No Comments | No TrackBacks
  1. 進入OS之後, VirtualBox Windows 的Menu, Device->Install Guest Additions

  2. 在OS裡會顯示要求安裝軟體, 安裝它.

  3. 安裝完成之後, 系統會要求重新啟動OS, 重新啟動.

  4. 打開Dos Prompt, 去到VirtualBox 的安裝目錄. 比如預設是:
    cd C:\Program Files\Sun\xVM VirtualBox

  5. 必須在VirtualBox 裡開啟OS的情況下, 輸入: VBoxManage controlvm "Windows XP" setvideomodehint "1280" "720" "32"
    ("Windows XP" 就是建立Virtual OS 的名稱.  "1280" "720" 就是螢幕解析度為1280*720.  "32" 就是32bit.)  設置一次就行了, 下次啟動Virtual OS 時, Virtual Windows/OS 的螢幕高寬度以及解析度就是當初設置的.

    p/s:  需要重新設置Virtual Windows/OS 的螢幕解析度時, 重新輸入 VBoxManage controlvm "Windows XP" setvideomodehint "螢幕寬度" "螢幕高度" "32" 就行了.

  6. 輸入完按Enter之後, Virtual Windows 已經變成1280*720的螢幕解析度了.

About this Archive

This page is an archive of entries from May 2009 listed from newest to oldest.

March 2009 is the previous archive.

July 2009 is the next archive.

Find recent content on the main index or look in the archives to find all content.