I have two classes namely ViewController and BViewController.
The BViewController class has properties name, address, and rating.
Below is the code for ViewController.m
How do I go about arranging objects in the array such that they are ordered by rating ascending? Additionally, how do I display them in a view?
- (void)viewDidLoad {
[super viewDidLoad];
BViewController *b=[[BViewController alloc]init];
b.name=@"x";
b.address=@"bangalore";
b.rating=@6;
BViewController *c=[[BViewController alloc]init];
c.name=@"y";
c.address=@"bangalore";
c.rating=@5;
BViewController *d=[[BViewController alloc]init];
d.name=@"z";
d.address=@"bangalore";
d.rating=@7;
BViewController *e=[[BViewController alloc]init];
e.name=@"abc";
e.address=@"bangalore";
e.rating=@4;
BViewController *f=[[BViewController alloc]init];
f.name=@"xyz";
f.address=@"bangalore";
f.rating=@8;
}