Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6709027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:49:53+00:00 2026-05-26T07:49:53+00:00

Actually I have parsed an XML and store URL’s of images as an NSMutableArray

  • 0

Actually I have parsed an XML and store URL’s of images as an NSMutableArray object, but I want this array to be used in another ViewController (to give to UIImage in UIImageView to show Images at runtime), so I am trying to copy that Mutable array to myAppDelegate_iPhone's NSMutableArray. And I want to again copy that Appdelegate’s array to my next or other ViewControllers NSMutableArray.

so can anyone help me out pleaseeeeee? Here is my code :-

code:-

@class FirstViewController;

@interface AppDelegate_iPhone : NSObject <UIApplicationDelegate> {
    UIWindow *window;

    FirstViewController *viewController;

    NSMutableArray *logoArray;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) NSMutableArray *logoArray;

@end



#import "AppDelegate_iPhone.h"
#import "FirstViewController.h"
#import "ParsingViewController.h"


@implementation AppDelegate_iPhone

@synthesize window,logoArray;


#pragma mark -
#pragma mark Application lifecycle

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    // Override point for customization after application launch.
    viewController = [[FirstViewController alloc]initWithNibName:@"FirstViewController" bundle:nil];
    viewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;


    NSURL *url = [[NSURL alloc] initWithString:@"http://litofinter.es.milfoil.arvixe.com/displayxml1.aspx"];
    NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:url];



    //Initialize the delegate.
    ParsingViewController *parser = [[ParsingViewController alloc] init];

    //Set delegate
    [xmlParser setDelegate:parser];

    //Start parsing the XML file.
    BOOL success = [xmlParser parse];

    if(success)
        NSLog(@"No Errors");
    else
        NSLog(@"Error Error Error!!!");

    logoArray = [[NSMutableArray alloc]init];

    [self.window addSubview:viewController.view];
    [self.window makeKeyAndVisible];

    return YES;
}

// dealloc done

@end


@class Litofinter,AppDelegate_iPhone;

@interface ParsingViewController : NSObject<NSXMLParserDelegate> {

    NSString *myString;
    NSMutableArray *myMutableArray;
    Litofinter *obj;
    NSString *currentElement;

    AppDelegate_iPhone *appDelegate;


}


#import "ParsingViewController.h"
#import "Litofinter.h"
#import "AppDelegate_iPhone.h"

@implementation ParsingViewController

@synthesize myMutableArray, myString;



-(id)init{
    if(self == [super init]){
        myMutableArray = [[NSMutableArray alloc] init];
    }
    return self; 
}




- (void)parserDidStartDocument:(NSXMLParser *)parser
{
    //myMutableArray = [[NSMutableArray alloc]init];

}

// Parsing done here


- (void)parserDidEndDocument:(NSXMLParser *)parser
{
    appDelegate = (AppDelegate_iPhone *)[[UIApplication sharedApplication] delegate];


    //UIApplication *app = [UIApplication sharedApplication];
    //appDelegate=app.delegate;

    appDelegate.logoArray = [[NSMutableArray alloc]initWithArray:myMutableArray];

    NSLog(@"appDelegate.logoArray count %d",[appDelegate.logoArray count]);

    for (Litofinter *lito in appDelegate.logoArray) {
        NSLog(@"Array Elements :----- %@",lito.cLogo);
    }
}


@end


#import <UIKit/UIKit.h>

@class AppDelegate_iPhone,Litofinter,ParsingViewController;

@interface FirstViewController : UIViewController {

    NSMutableArray *array;
    //Litofinter *lito;
    NSString *logoString;
    AppDelegate_iPhone *appDelegate;

    ParsingViewController *obj;

}

@end



#import "FirstViewController.h"
#import "AppDelegate_iPhone.h"
#import "Litofinter.h"

#import "ParsingViewController.h"

@implementation FirstViewController

-(id)init{
    if(self == [super init]){
        obj = [[ParsingViewController alloc] init];
        array = [[NSArray alloc] initWithArray: obj.myMutableArray];
    }
    return self; 
}
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];

    int x=5,y=10;


    appDelegate = (AppDelegate_iPhone *)[[UIApplication sharedApplication] delegate];


//  UIApplication *app = [UIApplication sharedApplication];
//  appDelegate=app.delegate;

    NSLog(@"delegate Array ====== %d",[appDelegate.logoArray count]);
    NSLog(@"New Array ====== %d",[obj.myMutableArray count]);

/*
    array = [[NSMutableArray alloc]initWithArray:appDelegate.logoArray];

    NSLog(@"array at 0 ===== %@",[array objectAtIndex:0]);

    for (Litofinter *lito1 in obj.myMutableArray) {
        NSLog(@"Array Elements in Lito1 are :------------- %@",lito1.cLogo);
    }

    for (Litofinter *lito2 in array) {
        NSLog(@"Array Elements in Lito1 are :------------- %@",lito2.cLogo);
    }
*/

    for (Litofinter *lito in obj.myMutableArray) {

    //for (int i=0; i<[appDelegate.logoArray count]; i++) {

    //  lito.cLogo = [array objectAtIndex:i];
        NSLog(@"%@",lito.cLogo);
        UIImage *imageFromUrl = [UIImage imageWithContentsOfFile:[NSURL fileURLWithPath:lito.cLogo]];



        UIImageView *imgView = [[UIImageView alloc] initWithImage:imageFromUrl];
        [imgView setFrame:CGRectMake(x, y, 196, 90)];
        [self.view addSubview:imgView];


        UITapGestureRecognizer *tgr = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTapImage)];
        [imgView addGestureRecognizer:tgr];
    //  [tgr release];

        //Do the rest of your operations here, don't forget to release the UIImageView
        x = x + 200;

    }


}


-(void)onTapImage
{
    UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Message from mAc" message:@"Trail" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok",nil];
    [alert show];
}



- (void)dealloc {
    [super dealloc];
}


@end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:49:53+00:00Added an answer on May 26, 2026 at 7:49 am

    You can use this.

    UIImage *imageFromUrl = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:lito.cLogo]]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an XML stream I want to parse using SAX. What I actually
This is a minimal test case of some code that I actually have. It
I'm new to HTML, but have a long history with XML. It strikes me
I have an XML file that I am trying to parse with Sax (this
I actually have right now two questions: 1) What font faces are preferred for
I actually have two questions regarding exception/error handling in the iPhone app that I
I actually have 2 queries: How do I display the data of a variable
I actually have two questions, the on in the title being the main one.
I actually have some questions (real childish). 1) If I know that a website
I started to use Borland's Turbo C++ a few days ago. I actually have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.