Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 07-28-2009, 03:14 AM   #1 (permalink)
Registered Member
 
Join Date: Jun 2009
Location: Australia
Posts: 180
Default Slide Keyboard From Right

I want to create a view just like iphone's contact edit view.

I have A UITextField inside UITableViewCell.

I want to focus on the UITextField inside the UITableViewCell, and make the keyboard slides with the view from the right.
now its appearing without sliding, but the view is.

Here is the code:

Code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
	
    static NSString *TrackEditCellIdentifer = @"TrackEditCellIdentifer";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:TrackEditCellIdentifer];
	
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:TrackEditCellIdentifer] autorelease];
		
		UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(10, 14, 200, 25)];
		textField.clearsOnBeginEditing = NO;
		textField.returnKeyType = UIReturnKeyDone;
		textField.font = [UIFont boldSystemFontOfSize:14];
		textField.enabled = YES;
		textField.tag = kTextFieldTag;
		textField.textColor = [UIColor blackColor];
		[textField becomeFirstResponder];
		[cell.contentView addSubview:textField];
		[textField release];

    }
	
	// Set up the cell...
	//NSUInteger row = [indexPath row];
	
	// determine the textfield
	UITextField *txtfield = (UITextField *)[cell viewWithTag:kTextFieldTag];
	txtfield.text = self.textFieldString;
	
	if ([self textType] == kNameKey)
		[txtfield setPlaceholder:@"Name"];
	if ([self textType] == kTagKey)
		[txtfield setPlaceholder:@"Tags"];
	
	[self setCurrentTextField:txtfield];

    return cell;
}
i have tried calling this in viewdidload and viewdidappear, but the results are the same.

Code:
- (void)viewDidLoad {
	[currentTextField becomeFirstResponder];
    [super viewDidLoad];
}

- (void)viewDidAppear:(BOOL)animated {
	[currentTextField becomeFirstResponder];
    [super viewWillAppear:animated];
}
svveet is offline   Reply With Quote
Old 04-22-2010, 10:41 AM   #2 (permalink)
Registered Member
 
Join Date: Apr 2010
Location: UK
Age: 24
Posts: 11
Default

I know this is an old post but I came across it when I was trying to solve a similar problem! Heres an answer for anyone else who is trying to do the same thing from my question at Stack Overflow:

UITextField subview of UITableViewCell to become first responder? - Stack Overflow
dg1234uk is offline   Reply With Quote
Reply

Bookmarks

Tags
keyboard, slide, uitextfield

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 249
18 members and 231 guests
ADY, Alsahir, beleg_1998, Dani77, e2applets, iph_s, JamesCahall, JasonR, mer10, Monstertaco, prchn4christ, Promo Dispenser, Robiwan, Rudy, smithdale87, timle8n1, Touchmint
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,880
Threads: 89,228
Posts: 380,756
Top Poster: BrianSlick (7,129)
Welcome to our newest member, @sandris
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:21 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0