我想在iphone中实现功能来显示AlertView中的表格并点击表格填充父视图的一些控件。iPhone:如何实现android AlertDialog像功能?
在Android中,我们可以通过AlertDialog来做到这一点,但IN Iphone我GOOGLE了但没有找到一些建议来实现这件事。
下面是Android的代码,而是如何通过IOS
new AlertDialog.Builder(MakeReservation.this).setTitle("Previous Locations").setItems(locArray, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String str = locArray[which];
if (str.contains(",")) {
String[] Address = str.split(",");
// String[] PickAddress = "Snoufer School, Gaithersburg, MD 45123".split(",");
if (Address.length > 0)
pickUpStreet.setText(Address[0]);
for (int i = 0; i < getResources().getStringArray(R.array.state_symbols).length; i++)
if (getResources().getStringArray(R.array.state_symbols)[i].equals(getStateCity[0])) {
pos = i;
break;
}
pickUpState.setSelection(pos);
}
if (getStateCity.length > 1)
pickUpZip.setText(getStateCity[1]);
}
}
}
}).create().show();
首先阅读委托模式。然后实现[UIAlertViewDelegate](http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIAlertViewDelegate_Protocol/UIAlertViewDelegate/UIAlertViewDelegate.html)方法之一。 – 2012-04-28 11:59:13