I have a problem
When I click the tabcontoller uıcollectionviewflowlayout position is changing :(
The following code does not work
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
UICollectionViewFlowLayout *collectionViewLayout = (UICollectionViewFlowLayout*)self.myCollectionView.collectionViewLayout;
collectionViewLayout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
}
before image:
When I click the tabcontoller
after image:
please help me
other image upload
updated:
Remove
UICollectionViewFlowLayout *collectionViewLayout = (UICollectionViewFlowLayout*)self.myCollectionView.collectionViewLayout;
collectionViewLayout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
from viewWillAppear and put it back in viewDidLoad.
- (void)viewDidLoad
{
[self.myCollectionView registerNib:[UINib nibWithNibName:PhotoCellIdentifier bundle:[NSBundle mainBundle]]
forCellWithReuseIdentifier:PhotoCellIdentifier];
self.myCollectionView.delegate=self;
self.myCollectionView.dataSource=self;
[self.myCollectionView setContentInset:UIEdgeInsetsMake(0, 0, 0, 0)];
[self yukle];
}
-(void) storkontrol:(NSArray*)skulist{
[[RMStore defaultStore] requestProducts:[NSSet setWithArray:skulist] success:^(NSArray *products, NSArray *invalidProductIdentifiers) {
if (products.count ==0)
{
self.eserList = nil;
[self sitedeveriyokbilgi];
} else
{
NSMutableArray *ll = [[NSMutableArray alloc] init];
int i =0;
// satın alışverişte alınan ürünelr geliyor
// NSLog(#"RMStore dan ürünler bekleniyor..");
for (SKProduct*urun in products) {
// NSLog(#"ürün : %#",urun.productIdentifier);
for (EserFiles*eser in self.eserList) {
if ([urun.productIdentifier isEqualToString:eser.eser.eserstokkod])
{
eser.eser.product = urun;
[ll insertObject:eser atIndex:i];
i++;
}
}
}
// NSSortDescriptor *sortDesc = [[NSSortDescriptor alloc] initWithKey:#"eser.esersayi" ascending:NO selector:#selector(compare:)];
// [ll sortUsingDescriptors:[NSArray arrayWithObject:sortDesc]];
self.eserList = ll;
// [HesapViewController setEserListVitrin: ll];
// [AyarlarViewController setEserListVitrin: ll];
[global setEserListVitrin: ll];
// NSLog(#"RMStore dan ürün çekme işlemi bitti");
[self.myCollectionView performSelectorOnMainThread:#selector(reloadData) withObject:nil waitUntilDone:NO];
_productsRequestFinished = YES;
[spinnerorta stopAnimating];
}
} failure:^(NSError *error) {
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
[spinnerorta stopAnimating];
NSLog(#"failure:^(NSError *error urunlist %#",error.localizedDescription);
}];
}
-(void)sitedeveriyokbilgi{
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 200, self.view.frame.size.width, 270)];
label.backgroundColor = [UIColor clearColor];
label.textAlignment = NSTextAlignmentCenter;
label.textColor = [UIColor grayColor];
label.numberOfLines = 0;
label.text = #"Listelenecek eser bulunamadı";
[self.view addSubview:label];
NSLog(#"Listelenecek eser bulunamadı");
[spinnerorta stopAnimating];
}
-(void)yukle{
spinnerorta = [[UIActivityIndicatorView alloc]
initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
spinnerorta.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin|UIViewAutoresizingFlexibleTopMargin|UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin;
spinnerorta.center = self.view.center;
[spinnerorta startAnimating];
[self.view addSubview: spinnerorta];
//eğer kategoriden geliyorsa hiç bir zamanön bellekleme olmayacak
__block NSArray *arry ;
NSMutableArray *skulist = [[NSMutableArray alloc] init];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
//ana sayfa ise
if (self.gelenviewid==1)
{
if ([[global getEserList] count] ==0 )
{
// NSLog(#"yeni liste alınıyor.......");
NSMutableArray *skulist = [[NSMutableArray alloc] init];
JSONLoader *jsonLoader = [[JSONLoader alloc] init];
arry = [jsonLoader locationsFromJSONFile];
} else{
self.eserList =[global getEserList];
// NSLog(#"ön bellekten doldu....");
[self.myCollectionView performSelectorOnMainThread:#selector(reloadData) withObject:nil waitUntilDone:NO];
// [spinnerorta stopAnimating];
return ;
}
} else if(self.gelenviewid==2)
{
arry = [JSONLoader getEserlerToKategory:self.catId];
}
if ([arry count] >0)
{
self.eserList = arry;
for (EserFiles*eserfile in self.eserList) {
// NSLog(#"sayı :%d %#",eserfile.eser.esersayi,eserfile.eser.kisaisim);
[skulist addObject:eserfile.eser.eserstokkod];
}
// dispatch_async( dispatch_get_main_queue(),
// ^{
[self storkontrol:skulist];
// });
} else {
dispatch_async( dispatch_get_main_queue(),^{
[spinnerorta stopAnimating];
[self sitedeveriyokbilgi];
});
}
});
}
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
return 1;
}
- (NSInteger)collectionView:(UICollectionView *)view numberOfItemsInSection:(NSInteger)section {
int count = self.eserList.count;
return count;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView
cellForItemAtIndexPath:(NSIndexPath *)indexPath{
// [collectionView setContentInset:UIEdgeInsetsMake(0, 0, 0, 0)];
EserFiles *esefiles =[self.eserList objectAtIndex:indexPath.row];
Eser *eser = esefiles.eser;
UrunCell *urunCell = [collectionView dequeueReusableCellWithReuseIdentifier:#"UrunCell" forIndexPath:indexPath];
UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc]
initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
spinner.frame = CGRectMake((urunCell.frame.size.width-25)/2, 50, 24, 24);
[spinner startAnimating];
[urunCell.contentView addSubview: spinner];
NSString *title = #"";
if ([eser.kisaisim isKindOfClass:[NSNull class]] || [eser.kisaisim isEqualToString:#""]){
title = eser.isim;
} else title = eser.kisaisim;
urunCell.UrunIsim.text=title;
// NSLog(#"title : %#",title);
[urunCell.UrunImage sd_setImageWithURL:[NSURL URLWithString:eser.kapakYol]
placeholderImage:[UIImage imageNamed:#"placeholder"] options:indexPath.row == 0 ? SDWebImageRefreshCached : 0];
[spinner stopAnimating];
return urunCell;
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
self.vitrinDetayViewController =[self.storyboard instantiateViewControllerWithIdentifier:#"VitrinDetayViewController"];
EserFiles *esefiles =[self.eserList objectAtIndex:indexPath.row];
self.vitrinDetayViewController.eser = esefiles;
[self.navigationController pushViewController:self.vitrinDetayViewController animated:YES];
}
- (void)viewWillAppear:(BOOL)animated {
// [self.myCollectionView setContentOffset:CGPointZero animated:NO];
[super viewWillAppear:animated];
UICollectionViewFlowLayout *collectionViewLayout = (UICollectionViewFlowLayout*)self.myCollectionView.collectionViewLayout;
// collectionViewLayout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
//[self.myCollectionView setContentOffset:CGPointZero animated:NO];
// self.automaticallyAdjustsScrollViewInsets = NO;
[spinnerorta stopAnimating];
}
Related
In my JSQMessagesViewController, when I load text message bubbles, the arrow direction is always right side.
How to change arrow direction to left for green bubbles??
My Code:
#interface AckChatViewController (){
JSQMessagesBubbleImage *outgoingBubbleImageView;
JSQMessagesBubbleImage *incomingBubbleImageView;
JSQMessagesAvatarImage *currentUserAvatar, *friendAvatar;
NSMutableArray *messages;
}
#end
#implementation AckChatViewController
pragma mark - life cycle methods
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
self.navigationController.navigationBar.topItem.title = #"";
//initial things for JSQMessageViewController
[self setupBubbles];
messages = [NSMutableArray new];
AllUserDetailsModel *temp = [[AllUserDetailsModel alloc] initWithDictionary:[Neo_Constants getSavedDataFromUserDafaults:USER_INFO_DICTIONARY]];
self.senderId = [NSString stringWithFormat:#"%#",temp.user_id];
self.senderDisplayName = #"";
self.automaticallyScrollsToMostRecentMessage = YES;
//remove attachment button
self.inputToolbar.contentView.leftBarButtonItem = nil;
currentUserAvatar = [JSQMessagesAvatarImage avatarImageWithPlaceholder: [self cropAvatarImages:[UIImage imageNamed:[self defaultImageForGender:temp.userDetails.gender]]]];
friendAvatar = [JSQMessagesAvatarImage avatarImageWithPlaceholder: [self cropAvatarImages:[UIImage imageNamed:[self defaultImageForGender:self.friendUserDetails.userDetails.gender]]]];
NSString *imageUrlString = temp.userDetails.profile_pic;
[self avatarImagesForUrlString:imageUrlString andOnCompletion:^(UIImage *image) {
if(image){
currentUserAvatar.avatarImage = image;
}
}];
[self avatarImagesForUrlString:self.friendUserDetails.userDetails.profile_pic andOnCompletion:^(UIImage *image) {
if(image){
friendAvatar.avatarImage = image;
}
}];
//set profile pic and name on navigation bar
[self setNavigationBarTitleView];
[self loadPreviousChatWithPageCount:0];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
pragma mark - JSQ Setups
-(void)setupBubbles{
JSQMessagesBubbleImageFactory *bubbleImageFactory = [JSQMessagesBubbleImageFactory new];
outgoingBubbleImageView = [bubbleImageFactory outgoingMessagesBubbleImageWithColor:[UIColor jsq_messageBubbleBlueColor]];
incomingBubbleImageView = [bubbleImageFactory outgoingMessagesBubbleImageWithColor:[UIColor jsq_messageBubbleGreenColor]];
}
pragma mark Collection view JSQ
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return messages.count;
}
-(id<JSQMessageData>)collectionView:(JSQMessagesCollectionView *)collectionView messageDataForItemAtIndexPath:(NSIndexPath *)indexPath{
return messages[indexPath.item];
}
-(id<JSQMessageBubbleImageDataSource>)collectionView:(JSQMessagesCollectionView *)collectionView messageBubbleImageDataForItemAtIndexPath:(NSIndexPath *)indexPath{
JSQMessage *message = messages[indexPath.item];
if([message.senderId isEqualToString:self.senderId]){
return outgoingBubbleImageView;
}else{
return incomingBubbleImageView;
}
}
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
JSQMessagesCollectionViewCell *cell = (JSQMessagesCollectionViewCell *)[super collectionView:collectionView cellForItemAtIndexPath:indexPath];
JSQMessage *message = messages[indexPath.item];
if([message.senderId isEqualToString:self.senderId]){
[cell.textView setTextColor:[UIColor whiteColor]];
}else{
[cell.textView setTextColor:[UIColor blackColor]];
}
return cell;
}
-(id<JSQMessageAvatarImageDataSource>)collectionView:(JSQMessagesCollectionView *)collectionView avatarImageDataForItemAtIndexPath:(NSIndexPath *)indexPath{
JSQMessage *message = messages[indexPath.item];
if([message.senderId isEqualToString:self.senderId]){
return currentUserAvatar;
}else{
return friendAvatar;
}
}
-(void)collectionView:(JSQMessagesCollectionView *)collectionView header:(JSQMessagesLoadEarlierHeaderView *)headerView didTapLoadEarlierMessagesButton:(UIButton *)sender{
}
//time stamp
-(NSAttributedString *)collectionView:(JSQMessagesCollectionView *)collectionView attributedTextForCellTopLabelAtIndexPath:(NSIndexPath *)indexPath{
return nil;
}
-(CGFloat)collectionView:(JSQMessagesCollectionView *)collectionView layout:(JSQMessagesCollectionViewFlowLayout *)collectionViewLayout heightForCellTopLabelAtIndexPath:(NSIndexPath *)indexPath{
return 0;
}
#pragma mark - private functions
-(NSString *)defaultImageForGender:(NSString *)gender{
if([gender isEqualToString:#"M"] || [gender isEqualToString:#""]){
return #"no_image_male";
}else{
return #"no_image_female";
}
}
-(void)setNavigationBarTitleView{
UIView *whole = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width - 100, 100)];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(5, 20, 50, 50)];
[imageView.layer setCornerRadius:25.0f];
[imageView setClipsToBounds:YES];
[imageView setContentMode:UIViewContentModeScaleAspectFill];
if([self.friendUserDetails.userDetails.profile_pic isEqualToString:#""] || [self.friendUserDetails.userDetails.profile_pic isEqual:[NSNull null]]){
if([self.friendUserDetails.userDetails.gender isEqualToString:#"M"]){
[imageView setImage:[UIImage imageNamed:#"no_image_male"]];
}else{
[imageView setImage:[UIImage imageNamed:#"no_image_female"]];
}
}else{
[imageView sd_setImageWithURL:[NSURL URLWithString:self.friendUserDetails.userDetails.profile_pic]];
}
UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(60, 20, [UIScreen mainScreen].bounds.size.width, 50)];
[nameLabel setText:self.friendUserDetails.userDetails.fname];
[whole addSubview:nameLabel];
[whole addSubview:imageView];
self.navigationItem.titleView = whole;
}
#pragma mark - Avtar images area
-(void)avatarImagesForUrlString:(NSString *)urlString andOnCompletion:(void(^)(UIImage *image))completion{
if([urlString isEqualToString:#""] || [urlString isEqual:[NSNull null]]){
completion(nil);
}else{
[[SDWebImageManager sharedManager] downloadImageWithURL:[NSURL URLWithString:urlString] options:0 progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
completion ([self cropAvatarImages:image]);
}];
}
}
-(UIImage *)cropAvatarImages:(UIImage *)image{
if(image){
return [JSQMessagesAvatarImageFactory circularAvatarImage:image withDiameter:48];
}else{
if([self.friendUserDetails.userDetails.gender isEqualToString:#"M"]){
return [UIImage imageNamed:#"no_image_male"];
}else{
return [UIImage imageNamed:#"no_image_female"];
}
}
}
#pragma mark - API calls
-(void)loadPreviousChatWithPageCount:(int)count{
[API fetchChatListOfUserWithParams:paramsDict andOnCompletion:^(NSDictionary *result, NSError *error){
if (!error) {
if ([[result objectForKey:#"status"] intValue]==1) {
NSArray *conversation_data = [result objectForKey:#"conversation_data"];
[messages removeAllObjects];
[conversation_data enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop){
JSQMessage *jsqMsg = [[JSQMessage alloc] initWithSenderId:obj[#"sender_id"] senderDisplayName:#"" date:obj[#"sent_date"] text:obj[#"message_content"]];
[messages insertObject:jsqMsg atIndex:idx];
}];
[self.collectionView reloadData];
}else{
[Neo_Constants showAlert:#"Error" Message:[result objectForKey:#"message"]];
}
}else{
[Neo_Constants showAlert:#"Error" Message:[error localizedDescription]];
}
}];
}
-(void)didPressSendButton:(UIButton *)button withMessageText:(NSString *)text senderId:(NSString *)senderId senderDisplayName:(NSString *)senderDisplayName date:(NSDate *)date{
// [JSQSystemSoundPlayer jsq_playMessageSentSound];
[API sendMessageFromUserWithParams:paramsDict andOnCompletion:^(NSDictionary *result, NSError *error){
if (!error) {
if ([[result objectForKey:#"status"] intValue]==1) {
[self loadPreviousChatWithPageCount:0];
[self.inputToolbar.contentView.textView setText:#""];
}else{
[Neo_Constants showAlert:#"Error" Message:[result objectForKey:#"message"]];
}
}else{
[Neo_Constants showAlert:#"Error" Message:[error localizedDescription]];
}
}];
}
#end
problem is in this code you initialise outgoing and incomming with the same method which is
outgoingMessagesBubbleImageWithColor
try incoming with
incomingMessagesBubbleImageWithColor
and outgoing with this
outgoingMessagesBubbleImageWithColor
this correct one
-(void)setupBubbles{
JSQMessagesBubbleImageFactory *bubbleImageFactory = [JSQMessagesBubbleImageFactory new];
outgoingBubbleImageView = [bubbleImageFactory outgoingMessagesBubbleImageWithColor:[UIColor jsq_messageBubbleBlueColor]];
incomingBubbleImageView = [bubbleImageFactory incomingMessagesBubbleImageWithColor:[UIColor jsq_messageBubbleGreenColor]];
}
I am new to iOS development and this is my first project that i am doing alone. i am trying to show the feed of my college's unofficial fb page using uicollectionview. I have been trying a lot of different things but nothing seems to work. The uilabel for the name is not being added to the collection view. However before i added the sizeForLabelAtIndexPath method which is to determine the size of the 2 ui labels and the height of the image to be displayed, the name label was working fine
UICollectionViewController.m file
- (void)viewDidLoad {
[super viewDidLoad];
self.title = #"DCE Speaks Up";
self.collectionView.backgroundColor = [UIColor colorWithWhite:0.95 alpha:1];
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = NO;
NSError *error= nil;
NSURL *feedURL = [NSURL URLWithString:#"https://graph.facebook.com/382057938566656/feed?fields=id,full_picture,message,story,created_time,link&access_token=1750413825187852%7CkUl9nlZFPvdGxGZX4WYabKKG2G4"];
NSData *jsonData = [NSData dataWithContentsOfURL:feedURL];
NSDictionary *dataDictionary= [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error];
self.feedArray = [NSMutableArray array];
NSArray *feedTempArray = [dataDictionary objectForKey:#"data"]; //feedTempArray just used for parsing
for (NSDictionary *feedDictionary in feedTempArray) {
FacebookFeed *fbFeed =[FacebookFeed facebookFeedWithMessage:[feedDictionary objectForKey:#"message"]];
fbFeed.story = [feedDictionary objectForKey:#"story"];
fbFeed.imageURL = [NSURL URLWithString:[feedDictionary objectForKey:#"full_picture"]];
fbFeed.date = [feedDictionary objectForKey:#"created_time"];
fbFeed.sharedLink = [NSURL URLWithString:[feedDictionary objectForKey:#"link"]];
[self.feedArray addObject:fbFeed];
}
// Register cell classes
[self.collectionView registerClass:[FacebookCollectionViewCell class] forCellWithReuseIdentifier:reuseIdentifier];
// Do any additional setup after loading the view.
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
FacebookCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath];
cell.feed = self.feedArray[indexPath.row];
cell.sizeDictionary = [self sizeForLabelAtIndexPath:indexPath.row collectionView:collectionView];
// Configure the cell
for (UIView *view in cell.contentView.subviews) {
if ([view isKindOfClass:[UILabel class]]) {
[view removeFromSuperview];
}else if ([view isKindOfClass:[UIImageView class]]){
[view removeFromSuperview];
}
}
cell.layer.shouldRasterize = YES;
cell.layer.rasterizationScale = [UIScreen mainScreen].scale;
return cell;
}
#pragma mark <UICollectionViewDelegateFlowLayout>
-(CGSize) collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
NSDictionary *sizeDictionary = [[NSDictionary alloc] init];
sizeDictionary = [self sizeForLabelAtIndexPath:indexPath.row collectionView:collectionView];
return CGSizeMake(self.view.frame.size.width - 20, [sizeDictionary[#"imageHeight"] floatValue] + [sizeDictionary[#"messageHeight"] floatValue] + [sizeDictionary[#"nameHeight"] floatValue]);
}
#pragma mark <UICollectionViewDelegate>
- (NSDictionary *) sizeForLabelAtIndexPath:(NSUInteger)indexPath collectionView:(UICollectionView *)collectionView{
FacebookFeed *feed = self.feedArray[indexPath];
CGSize nameSize = CGSizeFromString(#"DCE Speaks Up");
CGSize imageSize = CGSizeMake(0, 0);
if (feed.imageURL) {
imageSize = CGSizeMake(470, 394);
}
float height = 80;
NSString *string = #"";
if (feed.message) {
string = [feed.message stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
}else if (feed.story){
string = [feed.story stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
}
if (string) {
NSDictionary *attributes = #{
NSFontAttributeName : [UIFont preferredFontForTextStyle:UIFontTextStyleBody]
};
CGRect bodyFrame =
[string boundingRectWithSize:CGSizeMake(CGRectGetWidth(collectionView.bounds),
CGFLOAT_MAX)
options:(NSStringDrawingUsesLineFragmentOrigin)
attributes:attributes
context:nil];
height += ceilf(CGRectGetHeight(bodyFrame));
}
return #{ #"imageHeight" : #(imageSize.height) , #"messageHeight" : #(height) , #"nameHeight" : #(nameSize.height)};
}
Custom cell file
#implementation FacebookCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self)
{
self.contentView.backgroundColor = [UIColor whiteColor];
// change to our custom selected background view
self.imageView = [[UIImageView alloc] init];
self.messageLabel = [[UILabel alloc] init];
self.nameLabel = [[UILabel alloc] init];
}
return self;
}
-(void) setFeed:(FacebookFeed *)feed{
_feed = feed;
self.messageLabel.numberOfLines = 0;
self.messageLabel.lineBreakMode = 0;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSData *data= [NSData dataWithContentsOfURL:feed.imageURL];
UIImage *theImage=[UIImage imageWithData:data];
dispatch_async(dispatch_get_main_queue(), ^{
self.imageView.image= theImage ;
});
});
if (feed.message) {
self.messageLabel.text = [[NSString alloc] initWithString:[feed.message stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
}else{
self.messageLabel.text = [[NSString alloc] initWithString:[feed.story stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
}
self.messageLabel.font = [UIFont fontWithName:#"ArialMT" size:11];
[self.messageLabel sizeToFit];
self.nameLabel.text = #"DCE Speaks Up";
[self.nameLabel setFont:[UIFont fontWithName:#"ArialMT" size:12]];
[self.nameLabel sizeToFit];
}
-(void) layoutSubviews{
NSLog(#"%#",self.feed);
self.nameLabel.frame = CGRectMake(10, 10, self.contentView.bounds.size.width, [self.sizeDictionary[#"nameHeight"] floatValue]);
float height = 200;
if (self.contentView.bounds.size.height - [self.sizeDictionary[#"messageHeight"] floatValue] -[self.sizeDictionary[#"nameHeight"] floatValue] >100) {
height = self.contentView.bounds.size.height - [self.sizeDictionary[#"messageHeight"] floatValue] -[self.sizeDictionary[#"nameHeight"] floatValue];
}
if (self.feed.imageURL) {
self.imageView.frame = CGRectMake(10, [self.sizeDictionary[#"messageHeight"] floatValue] +[self.sizeDictionary[#"nameHeight"] floatValue], self.contentView.bounds.size.width - 20,height);
self.messageLabel.frame = CGRectMake(10, [self.sizeDictionary[#"nameHeight"] floatValue] +10, self.contentView.bounds.size.width - 10, [self.sizeDictionary[#"messageHeight"] floatValue]);
[self.contentView addSubview:self.messageLabel];
[self.contentView addSubview:self.imageView];
}else{
self.messageLabel.frame = CGRectMake(10, [self.sizeDictionary[#"nameHeight"] floatValue], self.contentView.bounds.size.width - 10, [self.sizeDictionary[#"messageHeight"] floatValue]);
[self.contentView addSubview:self.messageLabel];
}
[self.contentView addSubview:self.nameLabel];
}
#end
I had a little problem which is I can't properly reload a new data in collectionview whilst scrolling down at the bottom of collectionviewcontroller. The problem I had starting at this code if (indexPath.row == [selectedVideoData count] - 1). Below is my full code for collectionviewcontroller :
#import "PageVideosCVC.h"
#import "facebook.h"
#import "MBProgressHUD.h"
#import <AFNetworking/AFNetworking.h>
#import <AVFoundation/AVFoundation.h>
#import <SDWebImage/UIImageView+WebCache.h>
#interface PageVideosCVC () <UICollectionViewDataSource,UICollectionViewDelegate>
#end
#implementation PageVideosCVC
#synthesize selectedVideoData, selectNextVideoData;
static NSString * const reuseIdentifier = #"Cell";
-(void) viewWillAppear:(BOOL)animated {
UINavigationBar *navBar = [[UINavigationBar alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 50)];
[UINavigationBar appearance].barTintColor = [UIColor lightGrayColor];
[self.view addSubview: navBar];
UIBarButtonItem *cancelItem = [[UIBarButtonItem alloc] initWithTitle:#"< Back"
style:UIBarButtonItemStylePlain
target:self
action:#selector(backButtonTapped:)];
// UIBarButtonItem *doneItem = [[UIBarButtonItem alloc] initWithTitle:#"Done"
// style:UIBarButtonItemStyleBordered
// target:self action:nil];
NSString *selectedPageName = [[NSString alloc] initWithFormat:#"%#", self.pageName];
UINavigationItem *navItem = [[UINavigationItem alloc] initWithTitle:selectedPageName];
// navItem.rightBarButtonItem = doneItem;
navItem.leftBarButtonItem = cancelItem;
navBar.items = [NSArray arrayWithObjects: navItem,nil];
[UIBarButtonItem appearance].tintColor = [UIColor blueColor];
}
- (void)viewDidLoad {
[super viewDidLoad];
self.automaticallyAdjustsScrollViewInsets = NO;
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
facebook *fb = [[facebook alloc] init];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
NSDictionary *fbVideoParams = #{ #"fields": #"videos.limit(10){source,description,thumbnails.limit(1),length}"};
[fb fetchVideoInformationFromPages:fbVideoParams videoID:self.videoID completionHandler:^(NSDictionary *videoResult) {
if (videoResult != nil) {
selectedVideoData = [videoResult valueForKeyPath:#"videos.data"];
dispatch_async(dispatch_get_main_queue(), ^{
[self.collectionView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
});
}
}];
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = NO;
// Register cell classes
// [self.collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:reuseIdentifier];
// Do any additional setup after loading the view.
}
#pragma mark <UICollectionViewDataSource>
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
return 1;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return selectedVideoData.count;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath];
// Configure the cell
// This is a last cell, I wanna load next video data from fb.
if (indexPath.row == [selectedVideoData count] - 1) {
NSString *fbToken = [facebook currentFBAccessToken];
NSString *fbNextVideoURL = [NSString stringWithFormat:#"https://graph.facebook.com/v2.5/606246146140197/videos?access_token=%#&pretty=0&fields=source,description,thumbnails.limit(1),length&limit=10&after=ODYxOTA5OTEzOTA3MTUx", fbToken];
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[manager GET:fbNextVideoURL parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
selectNextVideoData = [responseObject valueForKey:#"data"];
NSLog(#"JSON Next Video: %#", selectNextVideoData);
dispatch_async(dispatch_get_main_queue(), ^{
[MBProgressHUD hideHUDForView:self.view animated:YES];
// I had a problem setting the right thumbnail here.
UIImageView *imgView = (UIImageView *)[cell viewWithTag:100];
NSURL *thumbnailImage = [NSURL URLWithString:[selectNextVideoData valueForKeyPath:#"thumbnails.data"]];
// NSLog(#"JSON Next Video: %#", thumbnailImage);
[imgView sd_setImageWithURL:thumbnailImage placeholderImage:[UIImage imageNamed:#"placeholder.jpg"]];
[self.collectionView reloadData];
});
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(#"Error: %#", error);
}];
} else {
UIImageView *imgView = (UIImageView *)[cell viewWithTag:100];
NSURL *thumbnailImage = [NSURL URLWithString:[selectedVideoData valueForKeyPath:#"thumbnails.data.uri"][indexPath.row][0]];
[imgView sd_setImageWithURL:thumbnailImage placeholderImage:[UIImage imageNamed:#"placeholder.jpg"]];
}
return cell;
}
#pragma mark <UICollectionViewDelegate>
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
// NSLog(#"videos : %#", selectedVideoData);
// NSLog(#"videos source : %#", [selectedVideoData valueForKeyPath:#"source"][indexPath.row]);
NSURL *videoURL = [NSURL URLWithString:[selectedVideoData valueForKeyPath:#"source"][indexPath.row]];
self.playerController = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
[[self.playerController view] setFrame:[self.view bounds]]; // Frame must match parent view
[self.view addSubview:[self.playerController view]];
self.playerController.movieSourceType = MPMovieSourceTypeStreaming;
self.playerController.controlStyle = MPMovieControlStyleFullscreen;
[[NSNotificationCenter defaultCenter] addObserver:self selector:#selector(doneButtonClick:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
[self.playerController play];
// Play the video using AVPlayer iOS9 above
// AVPlayer *player = [AVPlayer playerWithURL:videoURL];
// AVPlayerLayer *playerLayer = [AVPlayerLayer playerLayerWithPlayer:player];
// playerLayer.frame = self.view.bounds;
// [self.view.layer addSublayer:playerLayer];
// [player play];
}
-(void)doneButtonClick:(NSNotification*)aNotification{
NSNumber *reason = [aNotification.userInfo objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];
if ([reason intValue] == MPMovieFinishReasonUserExited) {
// Your done button action here
// [self dismissViewControllerAnimated:YES completion:nil];
NSLog(#"done button tapped");
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerDidExitFullscreenNotification
object:nil];
[self.playerController stop];
[self.playerController.view removeFromSuperview];
}
}
- (IBAction)backButtonTapped:(id)sender {
[self dismissViewControllerAnimated:YES completion:nil];
}
#end
Perhaps rather than this approach you can try scrollView Delegate Methods :
- (void)scrollViewDidScroll:(UIScrollView *)aScrollView {
CGPoint offset = aScrollView.contentOffset;
CGRect bounds = aScrollView.bounds;
CGSize size = aScrollView.contentSize;
UIEdgeInsets inset = aScrollView.contentInset;
float y = offset.y + bounds.size.height - inset.bottom;
float h = size.height;
// NSLog(#"offset: %f", offset.y);
// NSLog(#"content.height: %f", size.height);
// NSLog(#"bounds.height: %f", bounds.size.height);
// NSLog(#"inset.top: %f", inset.top);
// NSLog(#"inset.bottom: %f", inset.bottom);
// NSLog(#"pos: %f of %f", y, h);
float reload_distance = 10;
if(y > h + reload_distance) {
NSLog(#"load more rows");
}
}
I am trying to show a UIActivityIndicatorView while my table view is loading data and have it disappear once loading is finished. The loading indicator never appears. What am I doing wrong?
#define kBgQueue dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
#define storeURL [NSURL URLWithString: #"https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=25&playlistId=PL9DC706DCCCE00188&key=AIzaSyBS4do208_KPGHAhszfVkHadSvtfSgr7Mo"]
#import "BBYoutubeVideosTableViewController.h"
#import "Reachability.h"
#import "TSMessage.h"
#import "TSMessageView.h"
#import "YoutubeCell.h"
#import "KFBYoutubeVideoView.h"
#import "KFBAppDelegate.h"
#interface BBYoutubeVideosTableViewController ()
{
UIActivityIndicatorView *loadingIndicator;
}
#end
#implementation BBYoutubeVideosTableViewController
#synthesize title, videoID, thumbURL, descriptionString, url, titleArray, videoIDArray, thumbArray, descriptionArray;
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:#"" style:UIBarButtonItemStylePlain target:nil action:nil];
UIImageView *backgroundImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:#"plain_app-background.png"]];
CGFloat width = [[UIScreen mainScreen]bounds].size.width;
CGFloat height = [[UIScreen mainScreen]bounds].size.height;
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
{
loadingIndicator = [[UIActivityIndicatorView alloc]initWithFrame:CGRectMake(width / 2, height / 2, 37, 37)];
loadingIndicator.center = CGPointMake(width / 2, height / 2 - 37);
}
else
{
loadingIndicator = [[UIActivityIndicatorView alloc]initWithFrame:CGRectMake(142, 365, 37, 37)];
}
loadingIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;
loadingIndicator.hidesWhenStopped = YES;
Reachability *networkReachability = [Reachability reachabilityForInternetConnection];
NetworkStatus networkStatus = [networkReachability currentReachabilityStatus];
if(networkStatus == NotReachable)
{
[TSMessage showNotificationWithTitle:#"Network Error" subtitle:#"No active network connection!" type:TSMessageNotificationTypeError];
[loadingIndicator stopAnimating];
}
else {
[self.tableView addSubview:loadingIndicator];
[loadingIndicator startAnimating];
}
self.title = #"Bluegrass & Backroads";
self.tableView = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStyleGrouped];
self.tableView.backgroundView = backgroundImage;
url = [NSURL URLWithString:#"https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=25&playlistId=PL9DC706DCCCE00188&key=AIzaSyBS4do208_KPGHAhszfVkHadSvtfSgr7Mo"];
dispatch_async(kBgQueue, ^{
NSData *data = [NSData dataWithContentsOfURL:url];
if (data == nil)
{
NSLog(#"data is nil");
}
else
{
[self performSelectorOnMainThread:#selector(fetchedData:) withObject:data waitUntilDone:YES];
}
});
}
- (void)viewDidDisappear:(BOOL)animated
{
[loadingIndicator stopAnimating];
}
- (void)fetchedData:(NSData *)responseData
{
NSError *error;
titleArray = [[NSMutableArray alloc]init];
videoIDArray = [[NSMutableArray alloc]init];
thumbArray = [[NSMutableArray alloc]init];
descriptionArray = [[NSMutableArray alloc]init];
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error];
NSArray *items = [json objectForKey:#"items"];
for (NSDictionary *item in items)
{
NSDictionary *snippet = [item objectForKey:#"snippet"];
title = [snippet objectForKey:#"title"];
videoID = [[snippet objectForKey:#"resourceId"] objectForKey:#"videoId"];
thumbURL = [[[snippet objectForKey:#"thumbnails"] objectForKey:#"default"] objectForKey:#"url"];
descriptionString = [snippet objectForKey:#"description"];
[titleArray addObject:title];
[videoIDArray addObject:videoID];
UIImage *thumbnailImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:thumbURL]]];
[thumbArray addObject:thumbnailImage];
[descriptionArray addObject:descriptionString];
}
[self.tableView reloadData];
[loadingIndicator stopAnimating];
}
- (IBAction)morePressed:(id)sender
{
NSURL *kyfbVideos = [NSURL URLWithString:#"https://www.youtube.com/playlist?list=PL9DC706DCCCE00188"];
[[UIApplication sharedApplication] openURL:kyfbVideos];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [titleArray count];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 215;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return 60;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
UIColor *kfbBlue = [UIColor colorWithRed:8.0/255.0f green:77.0/255.0f blue:139.0/255.0f alpha:1];
UIView *footerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, tableView.frame.size.height)];
footerView.backgroundColor = [UIColor clearColor];
CGFloat width = footerView.frame.size.width;
UIButton *moreButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
moreButton.backgroundColor = [UIColor clearColor];
[moreButton setTitle:#"More" forState:UIControlStateNormal];
[moreButton setTitleColor:kfbBlue forState:UIControlStateNormal];
moreButton.titleLabel.textAlignment = NSTextAlignmentCenter;
moreButton.titleLabel.font = [UIFont fontWithName:#"FranklinGothicStd-ExtraCond" size:25.0];
moreButton.frame = CGRectMake(width / 2 - 25, 0, 50, 50);
moreButton.layer.cornerRadius = 25.0;
moreButton.layer.borderWidth = 2.0f;
moreButton.layer.borderColor = kfbBlue.CGColor;
moreButton.clipsToBounds = YES;
moreButton.backgroundColor = [UIColor clearColor];
[moreButton addTarget:self action:#selector(morePressed:) forControlEvents:UIControlEventTouchUpInside];
[footerView addSubview:moreButton];
return footerView;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UIColor *kfbBlue = [UIColor colorWithRed:8.0/255.0f green:77.0/255.0f blue:139.0/255.0f alpha:1];
YoutubeCell *cell = [tableView dequeueReusableCellWithIdentifier:#"youtubeCell"];
if (!cell)
{
NSArray *nibs =[[NSBundle mainBundle] loadNibNamed:#"YoutubeCell" owner:self options:NULL];
cell = [nibs firstObject];
}
cell.videoTitle.text = [titleArray objectAtIndex:indexPath.row];
cell.videoDescription.text = [descriptionArray objectAtIndex:indexPath.row];
cell.videoThumbnail.image = [thumbArray objectAtIndex:indexPath.row];
cell.videoTitle.textColor = kfbBlue;
cell.videoDescription.textColor = kfbBlue;
cell.videoTitle.font = [UIFont fontWithName:#"FranklinGothicStd-ExtraCond" size:22.0];
cell.videoDescription.font = [UIFont fontWithName:#"FranklinGothicStd-ExtraCond" size:16.0];
cell.backgroundColor = [UIColor clearColor];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
{
KFBYoutubeVideoView *videoView = [[KFBYoutubeVideoView alloc]init];
videoView.videoIDString = [videoIDArray objectAtIndex:indexPath.row];
videoView.videoTitle = [titleArray objectAtIndex:indexPath.row];
videoView.videoDescription = [descriptionArray objectAtIndex:indexPath.row];
[self.navigationController pushViewController:videoView animated:YES];
}
else
{
KFBYoutubeVideoView *videoView = [[KFBYoutubeVideoView alloc]initWithNibName:nil bundle:nil];
videoView.videoIDString = [videoIDArray objectAtIndex:indexPath.row];
videoView.videoTitle = [titleArray objectAtIndex:indexPath.row];
videoView.videoDescription = [descriptionArray objectAtIndex:indexPath.row];
NSMutableArray *details = [self.splitViewController.viewControllers mutableCopy];
UINavigationController *detailNav = [[UINavigationController alloc]initWithRootViewController:videoView];
[details replaceObjectAtIndex:1 withObject:detailNav];
KFBAppDelegate *appDelegate = (KFBAppDelegate *)[[UIApplication sharedApplication]delegate];
appDelegate.splitViewController.viewControllers = details;
appDelegate.window.rootViewController = self.splitViewController;
appDelegate.splitViewController.delegate = videoView;
[appDelegate.splitViewController viewWillAppear:YES];
}
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#end
I figured it out. tableView was being initialized after adding loadingIndicator as a subview.
in the
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if(indexPath.row==[self.peopleDataController countOfList]){
static NSString *CellIdentifier = #"LastMoreCell";
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] ;
moreButton = [[UIButton alloc] initWithFrame:CGRectMake(140, 2, 42, 42)];
[moreButton setImage:[UIImage imageNamed:#"more.png"] forState:UIControlStateNormal];
[moreButton addTarget:self action:#selector(showMoreRows:) forControlEvents:UIControlEventTouchUpInside];
[cell addSubview:moreButton];
return cell;
}
}
-(void) showMoreRows:(id)sender {
MyAuraAppDelegate *delegate = (MyAuraAppDelegate *) [[UIApplication sharedApplication] delegate];
refreshlast = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
refreshSpinner.hidesWhenStopped = YES;
refreshlast.center = CGPointMake([[sender superview] superview].bounds.size.width / 2.0f, [[sender superview] superview].bounds.size.height / 2.0f);
[sender setHidden:YES];
[[sender superview].superview addSubview: refreshSpinner];
[refreshlast startAnimating];
dispatch_queue_t dloadQueue = dispatch_queue_create("People refresh", NULL);
dispatch_async(dloadQueue, ^{
if ([[[GlobalVariable sharedInstance] peopleList] count] >0) {
_peopleDataController = [_peopleDataController initPeopleListWithCoordinate:delegate.locationCoordinate2D auraId:delegate.myToken offset:0];
NSLog(#"eerrrr %d",_peopleDataController.peopleList.count);
// _peopleDataController.peopleList=[[GlobalVariable sharedInstance] peopleList];
for (int i=0; i< [_peopleDataController.peopleList count]; i++) {
[[[GlobalVariable sharedInstance] peopleList ] addObject:[_peopleDataController.peopleList objectAtIndex:i]];
}
_peopleDataController.peopleList =[[GlobalVariable sharedInstance] peopleList] ;
NSLog(#"eerrr33r %d",_peopleDataController.peopleList.count);
}
dispatch_async(dispatch_get_main_queue(), ^{
[self performSelector:#selector(addItem) withObject:nil afterDelay:2.0];
});
});
dispatch_release(dloadQueue);
}
but my UIActivityIndicatorView refresh last not show,can you give me some clue?
i found my mistake is :[sender superview].superview is the tabview not the tableviewcell
so last i modify my code:
-(void) showMoreRows:(id)sender {
UIButton *button=(UIButton*)sender;
MyAuraAppDelegate *delegate = (MyAuraAppDelegate *) [[UIApplication sharedApplication] delegate];
refreshlast = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
refreshSpinner.hidesWhenStopped = YES;
UITableViewCell *lastcell=(UITableViewCell*)[button superview];
refreshlast.center = CGPointMake(lastcell.frame.size.width / 2.0f, lastcell.frame.size.height / 2.0f);
NSLog(#"ddd %f",lastcell.frame.size.height);
[button setHidden:YES];
[lastcell addSubview:refreshlast];
[refreshlast startAnimating];
dispatch_queue_t dloadQueue = dispatch_queue_create("People refresh", NULL);
dispatch_async(dloadQueue, ^{
if ([[[GlobalVariable sharedInstance] peopleList] count] >0) {
_peopleDataController = [_peopleDataController initPeopleListWithCoordinate:delegate.locationCoordinate2D auraId:delegate.myToken offset:0];
NSLog(#"eerrrr %d",_peopleDataController.peopleList.count);
// _peopleDataController.peopleList=[[GlobalVariable sharedInstance] peopleList];
for (int i=0; i< [_peopleDataController.peopleList count]; i++) {
[[[GlobalVariable sharedInstance] peopleList ] addObject:[_peopleDataController.peopleList objectAtIndex:i]];
}
_peopleDataController.peopleList =[[GlobalVariable sharedInstance] peopleList] ;
NSLog(#"eerrr33r %d",_peopleDataController.peopleList.count);
}
dispatch_async(dispatch_get_main_queue(), ^{
[self performSelector:#selector(addItem) withObject:nil afterDelay:2.0];
});
});
dispatch_release(dloadQueue);
}