I'd like to include one UITextView and one TextField in the headsection of 
tableView. So I subclass UIView and tried to override the drawRect method. I 
read the reference guide of UITextField drawRect method, "You should not call 
this method directly." How can I include a UiTextField in my customized UIView?
when I called method drawInRect, it broke, please kindly find my code as 
follows. 
And I found UITextView has no drawTextInRect, I called drawRect instead, but it 
did not work and I had no output.


- (void)drawRect:(CGRect)rect {
 // Drawing code
    UIImage *myImage = [UIImage imageNamed:@"zzm_o.png"];
 [myImage drawInRect:CGRectMake(0, 0, 80, 60)];
 UILabel *labelTest = [[[UILabel alloc] initWithFrame: CGRectMake(0, 50, 200, 
20)] autorelease];
 labelTest.font = [UIFont systemFontOfSize: 15.0];
 labelTest.textAlignment = UITextAlignmentLeft;
 labelTest.textColor = [UIColor blueColor];
 labelTest.backgroundColor = [UIColor whiteColor];
 labelTest.text = @"Test Label";
 //[labelTest drawTextInRect:CGRectMake(0, 50, 80, 30)];
 
 /*UITextField *aTextField = [[UITextField alloc] initWithFrame:CGRectMake(0, 
50, 200, 20)];
    aTextField.borderStyle = UITextBorderStyleBezel;
    aTextField.textColor = [UIColor whiteColor];
 aTextField.font = [UIFont systemFontOfSize:15.0];
    aTextField.placeholder = @"<enter email>";
    aTextField.backgroundColor = [UIColor blackColor];
 
 aTextField.keyboardType = UIKeyboardTypeDefault;
 aTextField.returnKeyType = UIReturnKeyDone;
 aTextField.delegate =self;
 
 
 aTextField.clearButtonMode = UITextFieldViewModeWhileEditing; // has a clear 
'x' button to the right 
 [aTextField drawTextInRect: CGRectMake(0, 50, 80, 30)];*/
 
 UITextView *commentBodytextView = [[[UITextView alloc] 
initWithFrame:CGRectMake( 0, 0, 200, 100)] autorelease];
 commentBodytextView.textColor = [UIColor whiteColor];
 commentBodytextView.font = [UIFont systemFontOfSize:15.0];
 commentBodytextView.backgroundColor = [UIColor blackColor];
 //commentBodytextView.delegate = self;   
 //textView.backgroundColor = [UIColor whiteColor];
 commentBodytextView.scrollEnabled = YES;
 //commentBodytextView.opaque = YES;
 //commentBodytextView.alpha = 1.0;
 
 commentBodytextView.text = @"Now is the time for all good people to come to 
serve their country.\n\n\nNow is the time for all good people to come to serve 
their country.";
 
 commentBodytextView.editable = NO;
 [commentBodytextView drawRect:CGRectMake( 0, 0, 200, 100)];
 
  
 UIFont *font = [UIFont boldSystemFontOfSize:20];
 [[UIColor whiteColor] set];
 NSString *string = @"Molinker Test!";
 [string drawAtPoint:CGPointMake(0, 65) withFont:font];
  
 
 
}

 
 
 
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to