devxoul / UITextView-Placeholder

A missing placeholder for UITextView
MIT License
1.48k stars 259 forks source link

TextView resets text if focused again #17

Closed iZeDeveloper closed 8 years ago

iZeDeveloper commented 9 years ago

UiTextView resets the text inside it and places placeholder label even if there is text inside textview written by user. unfocus the textview and then focus again... all text cleared.

devxoul commented 9 years ago

@zeshanhayder can you attach screenshots or video?

iZeDeveloper commented 9 years ago
screen shot 2015-10-28 at 11 39 58 am

Added Comment

screen shot 2015-10-28 at 11 40 04 am

Lost Focus

screen shot 2015-10-28 at 11 40 10 am

After getting focus back.

devxoul commented 9 years ago

What is placeholder? The MESSAGE?

iZeDeveloper commented 9 years ago

ye

devxoul commented 9 years ago

@zeshanhayder, could you show me your code?

iZeDeveloper commented 9 years ago

i just implemented .placeholder property of your category and included category as well.

self.tvMessage.textColor = placeHolderColor; self.tvMessage.placeholder = eloc; self.tvMessage.delegate = self;

devxoul commented 9 years ago

Which environment did you test?

iZeDeveloper commented 9 years ago

ios 9 - iphone 6

devxoul commented 9 years ago

Does it occur with bare project? I've tested with this code but cannot reproduce the issue.

#import "ViewController.h"
#import "UITextView+Placeholder.h"

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    UITextView *textView = [[UITextView alloc] init];
    textView.frame = CGRectMake(0, 20, CGRectGetWidth(self.view.bounds), 100);
    textView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    textView.placeholder = @"My Placeholder";
    textView.font = [UIFont systemFontOfSize:15];
    [self.view addSubview:textView];

    UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self
                                                                                 action:@selector(didTapBackground)];
    [self.view addGestureRecognizer:recognizer];
}

- (void)didTapBackground {
    [self.view endEditing:YES];
}

@end
iZeDeveloper commented 9 years ago

thats strange. it happens to me everytime.

devxoul commented 9 years ago

@zeshanhayder On your real iPhone 6 device? (Unfortunately I don't have iPhoen 6 device :cry:)

iZeDeveloper commented 9 years ago

no even on simulator it does the same. i will try to upload a video asap i got free time

devxoul commented 9 years ago

@zeshanhayder Thanks.

devxoul commented 8 years ago

Please reopen it when you available :)