Add dynamic text on uilabel programatically

-(void)subImagetap:(UITapGestureRecognizer *)subimagetap
{
    UIView *myV = (UIView *)subimagetap.view ;


    NSArray *lbarray = subimagetap.view.subviews;
    for (UIView *textV in lbarray) {
        UILabel *textlb = (UILabel *)textV;
        if([textlb isKindOfClass:[UILabel class]]) {
            NSLog(@"%@", textlb.text);
            textlb.text = @"Tapped";
        }
    }

}

The above mentioned code is my UITapGestureRecognizer code through with I tap on a label and changed his text to "Tapped" but my requirement is when I tap on the label the textpad of iphone will open and i could able to put text in that label.

Answers


You should use UITextFields if you want the user to be able to directly manipulate their content. Using a text field, you can still do what you're doing by modifying the text property, but UITextField supports editing with the keyboard as well.

You can even dress the text field up to look just like a UILabel through use of its borderStyle property. (Set it to UITextBorderStyleNone)


Need Your Help

How to deploy a python project to an environment that has not install some third-party libraries?

python deployment egg

I have a project that using some third-party libraries. My questions is how to deploy my project to an environment that has not install these third-party libraries. In Java, I can just put all jars...