2013-05-16 2 views
0

Как изменить размер изображения в Facebook с помощью WIDTH: AUTO & ВЫСОТА: x сумма? Код ниже работает, но когда аватар шире, кажется, что изображение тесно.Как изменить размер профиля Facebook Профиль по высоте на Xcode?

/** 

* Обновление аватара */ - (Недействительными) handleAvatar { если ([[само счет] getAvatar]) { если { [self.avatarImageView setHidden ([само avatarDrawn]!): НЕТ ];

 [ApiGateway avatarImage: [self account] 
       completionHandler: ^(UIImage *fetchedImage, NSURL *fetchedURL, BOOL isInCache) { 
        UIImage * roundedImage = [UIImage roundImage:[UIImage imageWithImage:fetchedImage scaledToSize:self.avatarImageView.frame.size] borderWidth:7.0f]; 
        [[self avatarImageView] setImage:roundedImage]; 
        [self setAvatarDrawn:YES]; 
        /** 
        @todo Remove strange thin border 
        */ 
       } errorHandler:^(NSError *error) { 
        [Util showNetworkError:error]; 
       }]; 
    } 
} else { 
    [self.avatarImageView setHidden:YES]; 
} 

}

ответ

0

Fixed, указав ширину и высоту FBRequestConnection параметров.

/** 
* Try to fetch an avatar 
*/ 
- (void) sessionStateChanged:(NSNotification*)notification { 
    if ([[self account] useFacebookAuthentication]){ 
     // Try and fetch an avatar 
     if ([[FBSession activeSession] isOpen]) { 
      // First up, get the facebook User data 
      [FBRequestConnection startWithGraphPath: @"me" 
             parameters: [NSDictionary dictionaryWithObject: @"picture.width(200).height(200)" forKey: @"fields"] 
             HTTPMethod: @"GET" 
            completionHandler: ^(FBRequestConnection *connection, id<FBGraphUser> fbuser, NSError *error) { 
             if (!error) { 
              // Set Avatar to account 
              [[self account] setAvatar:[fbuser objectForKey:@"picture"][@"data"][@"url"]]; 
              // Update cell 
              NSIndexPath *mypath = [NSIndexPath indexPathForRow:0 inSection:0]; 
              DashboardCell *cell = (DashboardCell *)[[self tableView] cellForRowAtIndexPath:mypath]; 
              [cell updateUI]; 
             } else { 
              NSLog(@"FB error %@", error); 
             } 
            }]; 
     } 
    } 
}