0
我在我的板球計分板應用程序中有三個文本字段。在ios中轉換拆分字符串
如果我點擊的每一個動作按鈕,我想每一個由0.1,0.2,0.3,0.4,0.5
每個接管數0.5後,它應該是1.0,那麼就應該繼續爲1.1,1.2。 ...... 1.5,2.1,2.2,2.3,2.4,2.5,3.1 ......
對於每一個動作按鈕,請幫助我,這
IBOutlet UITextField *score;
IBOutlet UITextField *wickets;
IBOutlet UITextField *overs;
-(IBAction)dot:(id)sender;
-(IBAction)extras:(id)sender;
這是我曾嘗試:
-(IBAction)dot:(id)sender
{
if(txtOvers.Text.split(「.」)[1]! = 5)
txtOver.text = txtOver.Text + .1;
else
txtOver.text = 0.5;
}
請告訴我們您嘗試過的。 – Vino 2014-12-03 04:51:30
- (IBAction爲)點:(ID)發送方{ 如果(txtOvers.Text.split()[1] = 5 txtOver.text = txtOver.Text + 0.1; 否則 txtOver.text = O「」! .5; – 2014-12-03 04:54:56