xpepermint
xpepermint

Reputation: 36273

iPad "about" UI element

I would like to know how Apple built the about view. It looks like that text is inside UITableView element but the whole cell is scrollable.

enter image description here

Upvotes: 1

Views: 183

Answers (4)

nate777
nate777

Reputation: 174

You can achieve this with a stock UITextView; it's a subclass of UIScrollView, so you can just add the logo imageview as a subview. Then, make room for the image on top by adjusting the text padding:

 textView.contentInset = UIEdgeInsetsMake(80,0,0,0);

Upvotes: 1

Caleb
Caleb

Reputation: 125007

No custom views are needed. All you have to do is configure the text view's layer appropriately. Here's a recipe that produces pretty much the effect you're looking for, assuming you have a UITextView in a view with light gray background:

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    [super viewDidLoad];

    self.textView.clipsToBounds = NO;
    CALayer *layer = self.textView.layer;
    layer.cornerRadius = 10.0;
    layer.borderWidth = 0.5;
    layer.borderColor = [[UIColor grayColor] CGColor];
    layer.shadowColor = [[UIColor whiteColor] CGColor];
    layer.shadowOffset = CGSizeMake(0.0, 1.0);
    layer.shadowOpacity = 1.0;
    layer.shadowRadius = 0.5;
}

I had some trouble getting the white shadow to display. This SO question explains that you need to set clipsToBounds to NO in order to get the shadow to work.

Here's a picture of the result. I've shown the bottom corner so that you can see the white drop shadow.

enter image description here

Edit: I see now that the view in the question probably is, in fact, a UIWebView. I think it's possible to embed inline images in a NSTextView, but that's probably not the case with UITextView. Anyway, the recipe above should work as well for a UIWebView as it does for UITextView (or any other view).

Upvotes: 1

Kristopher Johnson
Kristopher Johnson

Reputation: 82545

My guess would be a UIWebView inside a custom table cell.

But that is just a guess. It could be a completely custom view, or various combinations of existing views.

Upvotes: 2

Rayfleck
Rayfleck

Reputation: 12106

If you have a tableview that has one section, one row, and the row has a view (UILabel or UITTextField) that is larger than the visible area on the screen, that would scroll like that. Or maybe just a UIScrollView with a UILabel in it.

Upvotes: 0

Related Questions