2016-05-06 3 views
0

私はIOSの分野では新しいので、ボタンの代わりにUIImageを使用する方法について少し混乱しています。私は画像の代わりにボタン付きの簡単な登録ページを出しました。また、私はUIImageにある同じアクションと警告を与えたい、ここに私のボタンアクションコードは次のとおりです。IOSのボタンの代わりにUIImageで登録する方法

(IBAction)regst:(id)sender 
{ 

    REG *rr=[NSEntityDescription insertNewObjectForEntityForName:@"REG" inManagedObjectContext:a.managedObjectContext]; 

    rr.name=[NSString stringWithFormat:@"%@",self.txt1.text]; 
    rr.username=[NSString stringWithFormat:@"%@",self.txt2.text]; 
    rr.password=[NSString stringWithFormat:@"%@",self.txt3.text]; 
    rr.age=[NSString stringWithFormat:@"%@",self.txt4.text]; 
    rr.email=[NSString stringWithFormat:@"%@",self.txt5.text]; 
    [a saveContext ]; 

    if 
(self.txt1.text.length && self.txt2.text.length && self.txt3.text.length && self.txt4.text.length && self.txt5.text.length!=0) 

    { 
     UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"ALERT VIEW" message:@"REGISTERED SUCCESSFULLY" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; 

     [alert show]; 

     [email protected]""; 
     [email protected]""; 
     [email protected]""; 
     [email protected]""; 
     [email protected]""; 
+0

あなたは適切に質問を編集できますか? – Madhu

答えて

0

は、ボタンからテキストを削除し、ボタンをコードで設定されている場合setBackgroundImage:forState:を使用するか、単純に背景を変更しますストーリーボードのボタンのイメージは、ストーリーボードで作成された場合

関連する問題