Wie setzen UITextfield-Breite dynamisch?

Ich habe die iPad-Anwendung.

Gibt es drei Fragen, die textfields. Ich habe Breite UITextField dynamisch text kommt aus webservice. und ich habe UITextField Breite gleiche wie Fragen text.

wenn Texte Frage klein ist, dann UITextField klein ist,
wenn Texte Frage der Größe ist, groß ist, dann UITextField groß ist,

Ich habe folgenden code.....

txtQuestionOne.hidden=NO;
            txtQuestionTwo.hidden=NO;
            txtQuestionThree.hidden=NO;

            imgQueone.hidden=NO;
            imgQueTwo.hidden=NO;
            imgQueThree.hidden=NO;

            [txtQuestionOne setPlaceholder:[[appDelegate.questions objectAtIndex:0] objectForKey:@"question"]];

            appDelegate.FirstQues =[[appDelegate.questions objectAtIndex:0] objectForKey:@"question"];

            NSLog(@"current q1 %@", [[appDelegate.questions objectAtIndex:0] objectForKey:@"question"]);


            if ([[[appDelegate.questions objectAtIndex:0] objectForKey:@"permission"] isEqualToString:@"1"]) {

                ratingButton1.hidden=NO;

                ratingLabel1.hidden=NO;
            }


            [txtQuestionTwo setPlaceholder:[[appDelegate.questions objectAtIndex:1] objectForKey:@"question"]];

            appDelegate.SecondQues =[[appDelegate.questions objectAtIndex:1] objectForKey:@"question"];

            NSLog(@"current q2 %@", [[appDelegate.questions objectAtIndex:1] objectForKey:@"question"]);

            if ([[[appDelegate.questions objectAtIndex:1] objectForKey:@"permission"] isEqualToString:@"1"]) {

                ratingButton2.hidden=NO;

                ratingLabel2.hidden=NO;
            }


            [txtQuestionThree setPlaceholder:[[appDelegate.questions objectAtIndex:2] objectForKey:@"question"]];

            appDelegate.ThridQues =[[appDelegate.questions objectAtIndex:2] objectForKey:@"question"];

            NSLog(@"current q3 %@", [[appDelegate.questions objectAtIndex:2] objectForKey:@"question"]);

            if ([[[appDelegate.questions objectAtIndex:2] objectForKey:@"permission"] isEqualToString:@"1"]) {

                ratingButton3.hidden=NO;

                ratingLabel3.hidden=NO;
            }

Bitte helfen Sie mir, ich weiß nicht, was kann ich tun?

  • Warum nutzen Sie nicht UILabel statt ?
InformationsquelleAutor Virja Rahul | 2012-08-31
Schreibe einen Kommentar