Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I also faced this issue few days ago...u need to make one class set properties whatever you want and then add that object in one array after that u can sort array on one property then whole array will be sorted</p> <pre><code>#import &lt;Foundation/Foundation.h&gt; @interface HomeFeed : NSObject @property (nonatomic, copy) UIImage *ItemImage; @property (nonatomic, copy) NSString *ItemTitle; @property (nonatomic, copy) NSString *ItemDate; @property (nonatomic, copy) NSString *ItemDescription; @property (nonatomic, copy) NSString *ItemHours; @property (nonatomic, copy) NSString *ItemID; @property (nonatomic, copy) NSString *itemDetailUrl; @property (nonatomic, copy) NSString *itemPerson; @property (nonatomic, copy) NSString *itemThumbUrl; @property (nonatomic, assign) int ItemDuration; @end #import "HomeFeed.h" @implementation HomeFeed @synthesize ItemTitle=_ItemTitle, ItemDate=_ItemDate, ItemImage=_ItemImage,ItemID=_ItemID,ItemDuration=_ItemDuration,ItemDescription,ItemHours=_ItemHours,itemDetailUrl,itemPerson,itemThumbUrl; @end NSArray*arr=[responseString JSONValue]; NSLog(@"Json Dictionary speakersss : %@",arr); NSLog(@"Json arr count speaker : %i",arr.count); for (int i=0; i&lt;arr.count; i++) { NSDictionary *dict=[[ NSDictionary alloc]init]; dict=[arr objectAtIndex:i]; HomeFeed *feed = [[HomeFeed alloc] init]; feed.ItemTitle = [NSString stringWithFormat:@"%@%@%@",[dict objectForKey:@"firstName"],@" ",[dict objectForKey:@"lastName"]]; feed.ItemDuration = [[NSString stringWithFormat:@"%@", [dict objectForKey:@"count"]] intValue]; feed.itemDetailUrl=[dict objectForKey:@"detailsUrl"]; [self.itemsDataArray addObject:feed]; [itemTitle addObject:feed.ItemTitle]; } HomeFeed *feed = [[HomeFeed alloc] init]; NSSortDescriptor *sorter = [[NSSortDescriptor alloc] initWithKey:@"ItemTitle" ascending:YES]; [self.itemsDataArray sortUsingDescriptors:[NSArray arrayWithObject:sorter]]; - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SpeakersCustomCell"]; cell.selectionStyle = NO; cell.accessoryType = NO; HomeFeed *feed = [self.itemsDataArray objectAtIndex:indexPath.row]; UIImageView *arrow = (UIImageView *)[cell viewWithTag:3]; arrow.image = [UIImage imageNamed:@"accessory.png"]; UILabel *lblLeft = (UILabel *)[cell viewWithTag:1]; UILabel *lblRight = (UILabel *)[cell viewWithTag:2]; lblLeft.text=feed.ItemTitle; - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ HomeFeed *feed=(HomeFeed*)[self.itemsDataArray objectAtIndex:indexPath.row]; self.onlinDetail.strUrl=feed.itemDetailUrl; NSString *key = @"OrientationStringValue"; NSDictionary *dictionary = [NSDictionary dictionaryWithObject:feed.itemDetailUrl forKey:key]; [[NSNotificationCenter defaultCenter] postNotificationName:@"NotifSpeaker1" object:nil userInfo:dictionary]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload