views:

31

answers:

0

Hi Guys,

While editing the text in text view the cursur is coming only to the half of the cell when we press enter button to edit then the cusur is not coming upto the end of the cell

I have given the height as 170 and cell height is 190. It looks perfect in User Interface but when we editing it i can't come upto end of the cell.

If I do 190 as its height then the text view is out of the cell of a table view.

I have given below code you can understand it. please help me out of this.

// declation part in Init

CGRect contentFrame = CGRectMake(5, 10, 291,170);
        textView = [[UITextView alloc] initWithFrame:contentFrame];
        textView.font = [UIFont boldSystemFontOfSize:16];
        textView.textColor=[UIColor blackColor];
        textView.backgroundColor = [UIColor blueColor];
        textView.returnKeyType = UIReturnKeyDefault;
        textView.keyboardAppearance  = UIKeyboardAppearanceDefault;
        textView.keyboardType = UIKeyboardTypeDefault;

        textView.delegate=self;
        [textView becomeFirstResponder];

Delegate methods

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 190;
}

- (UITableViewCell *)tableView:(UITableView *)tableView1 cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"MyIdentifier"];
    if (cell == nil) 
    {
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"MyIdentifier"] autorelease];
        UIView* elementView =  [ [UIView alloc] initWithFrame:CGRectMake(5,5,290,480)];
        elementView.tag = 0;
        [cell.contentView addSubview:elementView];
        [elementView release];
    }

    UIView* elementView  = [cell.contentView viewWithTag:0];
    for(UIView* subView in elementView.subviews)
    {
        [subView removeFromSuperview];
    }
           textView.text=Object.notes;
       [elementView addSubview:textView];
    }
    return cell;
}