Reputation: 6967
So, I've tried looking all around for information on how to recreate a UILabel (ideally, or a UITextField) with a title (for lack of better work).
Since it's quite hard to explain (half the reason I couldn't find what I was looking for) I've attached an image from the Facebook App.
How would I go about creating labels like this? Either single, or multiple?
Sorry for the simple question, still new to iPhone development.
Upvotes: 2
Views: 1648
Reputation: 8593
If you're doing it in a UITableView
like the one shown in your capture, you can use the UITableViewCell textLabel
property to display a standard left aligned label. Then you only add the UITextField
to the cell.
I've done exactly this in an app, it looks good and is pretty simple.
UPDATE: Something like this (untested, may have some typos):
UITextField *textField = nil;
UITableViewCell *cell = [tableView dequeueCellWithReuseIdentifier: kIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault];
textField = [[UITextField alloc] init];
textField.tag = 12345;
[cell addSubview: textField];
textField.frame = CGRectMake(50, 5, 70, 25);
}
else
{
textField = [cell viewWithTag: 12345];
}
UPDATE2: UITextField wasn't added to UITableCellView.
Upvotes: 2