まず、NSXMLParser
を使用してXMLを解析し、ボタンのプロパティを取得できます。あなたが必要とするどのように多くのタグを知ったら、あなたは繰り返すことができ
NSXMLParser Class Reference
:
for (int i = 0; i < numTags; i++) {
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
// The tag is so when clicked, you can determine which one was pressed
// It would help to have your links stored in an NSArray, so you can pull
// them out by index.
button.tag = i;
[button setTitle:buttonName forState:UIControlStateNormal];
[button addTarget:self action:@selector(openButtonLink:) forControlEvents:UIControlEventTouchDown];
[button setImage:buttonImage forState:UIControlStateNormal];
button.frame = ...; // How do you want your buttons laid out?
[someView addSubview:button];
}
私もUIButton
のクラス参照をチェックアウトをお勧めします:
UIButton Class Reference
OKあなたの助けてくれてありがとう、私はそれがうまくいくと思う! – Vanjo