2011-04-13 55 views
1

我正在創建一個應用程序,它有一個像圖片庫一樣的模塊。當我解析一個XML時,它會給出一些圖像,比如10,並顯示在表格的行中。現在,當從表中選擇一行時,在我的下一個視圖中,它應該在表格的行中顯示10個圖像的縮略圖。一行應該包含4個小圖像等等。圖片庫使用表格視圖

有什麼好的編程建議?

感謝

+1

剛開始......... – Robin 2011-04-13 05:06:46

+0

你是真的。 。 。 :D – Maulik 2011-04-13 05:10:05

回答

1

如果您不需要對這些單元格重新排序函數,那麼您可以通過繼承UITableviewCell實現,其中每個單元格包含4個按鈕。可以通過代表發送觸發內部消息。

更新:

自定義單元格例如:

@protocol MyCellDelegate <NSObject> 
    - (void)notifyCell:(MyCell *)cell didTouchupInside:(UIButton *)innerButton; 
    @end 

    @interface MyCell : UITableViewCell { 
    @private 
     // easy to understand button example 
     // you can use array or dictionary to manage your buttons. 
     UIButton *mButton1; 
     UIButton *mButton2; 
     UIButton *mButton3; 
     UIButton *mButton4; 

     // Other member variables. 
    } 

    @property (nonatomic, assign) id <MyCellDelegate> delegate; 

    - (id)initWithReuseIdentifier:(NSString *)reuseIdentifier delegate:(id)delegate; 

    @end 

通過MyCellDelegate,客戶端就可以知道了myCell對象會發生什麼。

+0

以及如果我想要選擇要在下一個視圖中顯示的特定圖像,我所做的事情。我必須爲此目的指定uibutton的哪些屬性。 – Maulik 2011-04-13 09:40:40

+0

您可以將目標和操作添加到UIButton,並通過委託來轉移這些事件。您可以爲委託人發送消息定義此子類化單元的自定義協議。 – AechoLiu 2011-04-13 10:02:12