0

私はニュースアプリで働いています。6つの異なるニュースがあります。viewwillappear() メソッドから RSS フィードを呼び出しています。selectedIndex で switch ケースを実行しました。遅延読み込みを含めましたが、それでも rss からニュースを読み込むには非常に時間がかかります。考えられる解決策はありますか?前もって感謝します

(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:YES];

    noNewsLabel.hidden=YES;
    bdNewsParser=[[[BDNewsParser alloc] init]retain];
    if (loadingFlag==1)
    {
        ImgesName=[[NSMutableArray alloc] init];
        dicImages_msg = [[NSMutableDictionary alloc] init];

    }
    if (loadingFlag!=2)
    {
        NSLog(@"newsTypeInd:%@",newsTypeInd);
        [newsCat setText:[newsTypeInd objectAtIndex:selectedIndex]];

        [newsTitleArray removeAllObjects];
        [newsDescriptionArray removeAllObjects];
        [newsLinkArray removeAllObjects];
        [newsPublicationDate removeAllObjects];
        [newsImageLinkArray removeAllObjects];
        [newsSourceArray removeAllObjects];

        switch(selectedIndex)
        {
            case 0:
                 [bdNewsParser loadXMLByURL:@"http://amarhost.info/fuad/newsainment/itnews.php"];
                break;
            case 1: 
                [bdNewsParser loadXMLByURL:@"http://amarhost.info/fuad/newsainment/internationalnews.php"];
                break;
            case 2: 
              //   [bdNewsParser loadXMLByURL:@"http://amarhost.info/fuad/newsainment/bangladeshnews.php"];
                [self showAlert];

                break;
            case 3: 
                //[bdNewsParser loadXMLByURL:@"http://amarhost.info/fuad/newsainment/businessnews.php"];
                [self showAlert];

                break;
            case 4: 
                [bdNewsParser loadXMLByURL:@"http://amarhost.info/fuad/newsainment/entertainmentnews.php"];
                break;
            case 5: 
                  [bdNewsParser loadXMLByURL:@"http://amarhost.info/fuad/newsainment/sportnews.php"];
                break;
           default:
                break;
        }


        newsTitleArray=bdNewsParser.titleArray;
        newsDescriptionArray=bdNewsParser.descriptionArray;
        newsLinkArray=bdNewsParser.linkArray;
        newsPublicationDate=bdNewsParser.publicationDateArray;
        newsImageLinkArray=bdNewsParser.newsImageArray;
        newsSourceArray=bdNewsParser.newsSourceArray;
        [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;

        // [self filterArrayGroupWise:selectedIndex];


        if ([newsTitleArray count]==0) {
            NSLog(@"Hide contrrol");
            [self hideControls];
            noNewsLabel.hidden=NO;
        }
        else {
            [self showControls];
            noNewsLabel.hidden=YES;
            [self setupScrollview];

            ImgesName = newsImageLinkArray;
            [self reloadScrolview];
        }

        savedTitleArr=[userDefault readArrayFromUserDefaults:@"FavoriteTitle"];
        if (savedTitleArr)
        {
            if ([savedTitleArr containsObject:[newsTitleArray objectAtIndex:pageNo]])
            {
                [saveButton setEnabled:NO];
            }
            else
            {
                [saveButton setEnabled:YES];
            }
        }
        else
        {
            [saveButton setEnabled:YES];
        }
    }

    indicatorAnimatingFlag=0;
    [activityView stopAnimating];

    UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapGestureCaptured:)];
    [scrollView addGestureRecognizer:singleTap];

    pageNo=0;
    CGRect frame = scrollView.frame;
    frame.origin.x = frame.size.width * 0;
    frame.origin.y = 0;
    [scrollView setBounds:frame];
    [bdNewsParser release];
    index=0;
    selectedIndex=0;
}    
4

1 に答える 1