0

i want to make an app for a little blog. (Looks little bit like the facebook timeline)

There is already a website for it. I know that i can make a HTML document to an app, but i want a native version.The website looks like that:

Image 1

The scructure is very simple: Title, image, title.

Now: I solve it like that:

I have in my mainview a UIScrollView. And add the control:

Image 2

And add the controls in a foreach where i grab the data:

MangoListItem *myLabel = [[MangoListItem alloc]initWithFrame:CGRectMake(0, 0, 200, 40)];
[myLabel setBackgroundColor:[UIColor redColor]];
[scrollView addSubview:myLabel]

First: Is this a good solution?

Second: How can i associate the .xib File with the .h File?

Thank you for your help!

Pawan Rai
  • 3,434
  • 4
  • 32
  • 42

1 Answers1

0
NSString * nibName = @"MyCustomView";
[[[NSBundle mainBundle] loadNibNamed:nibName owner:self options:nil] firstObject];
cohen72
  • 2,830
  • 29
  • 44
  • Thanks for the answer. Where do i have to put that code? – Asmar Demir Feb 23 '15 at 10:58
  • put that in the viewdidload. You could also simply instantiate your UIViewController using initWithNibName: from the start, that will save you some time, and be easier for you. Take a look here for a tutorial: http://www.idev101.com/learn/view_controllers.html – cohen72 Feb 23 '15 at 12:35
  • Thank you for your help. I try to solve it in combination with this post: http://stackoverflow.com/questions/14144672/custom-xib-based-ui-control – Asmar Demir Feb 23 '15 at 13:53