views:

1667

answers:

2

hi i am using below code to change the the font type of text view. but its not changing the font

textView3.font = [UIFont fontWithName:@"Helvetica" size:17.0f]; tell me where i am wrong.

A: 

That code is correct. If that is the code that you are using, you should check whether it is being called. Try putting an NSLog("changing font"); call right before it or something, so you can tell whether or not it is really happening.

A few suggestions, though. There is probably a more descriptive name for your textview than textView3. Don't worry about your variable names being too verbose; believe me, it's a good thing. Also, if textView3 is an instance variable, you really shouldn't be accessing it directly. Use encapsulation by declaring it as a @property and then @synthesize-ing it. Then, your call might look like self.textViewThatDoesSomething.font = ….

Good luck!

Update: I just had another idea. It may be that your textView3 is not hooked up properly in Interface Builder. Check that and try again.

Jonathan Sterling
+1  A: 

use dude textview.font = [UIFont fontWithName:@"Arial" size:FontSize]; it will inshallah solve your problem no worry... where the FontSize is (int )......

UMER