2012-08-10 2 views
0
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex 
{ 
    forTweet = TRUE; 
    switch(buttonIndex) 
    { 
      case 0: 
      { 
       TWTweetComposeViewController *tweetViewController = [[TWTweetComposeViewController alloc] init]; 

       // Set the initial tweet text. See the framework for additional properties that can be set. 
       NSMutableString * twitterString = [displayString mutableCopy]; 
       [twitterString appendString: @" #LoviOtvet"]; 

       [tweetViewController setInitialText: twitterString]; 

       UIImage * imageAnswer = [self getImageFromURL: [self strToUrlConverter]]; 
       UIImage * imageLogo = [[UIImage alloc] initWithContentsOfFile: @"image.png"]; 

       [tweetViewController addImage: [self mergeImage:imageAnswer withImage:imageLogo strength:1]]; 


       break; 
      } 

J'ai ajouté. Pas d'erreurs, mais ne fonctionne pas. Facebook et l'enregistrement au travail de l'appareil. Tweeting pas. Pourquoi pas?Impossible de tweeter une image

+0

est 'mergeImage: withImage: strength' en fait une image retour ? –

+0

- (UIImage *) mergeImage: (UIImage *) imageA avecImage: (UIImage *) force de l'imageB: (flottant) force; – Lager

+0

Je pense que Stephen signifie que l'objet retourné est vraiment une image (pas nul par exemple) – igoris

Répondre

2

Votre problème est cette ligne:

UIImage * imageLogo = [[UIImage alloc] initWithContentsOfFile: @"image.png"]; 

Pour cette méthode, vous devez besoin de fournir un chemin de fichier, pas un nom. Vous avez deux choix:

UIImage * imageLogo = [UIImage imageNamed:]

ou (pour un fichier dans le paquet):

NSString *path = [[NSBundle mainBundle] pathForResource:@"image" ofType:@"png"]; 
UIImage * imageLogo = [[UIImage alloc] initWithContentsOfFile:path]; 
+0

Non, dans le code d'origine il y a chemin d'état. Mais ici, je l'ai changé, ce n'était pas un bon choix. – Lager

+0

OK - puis ajoutez un journal ou assert() après avoir défini "UIImage * imageLogo" - voulez parier que c'est nul ??? –

Questions connexes