• Wieder einmal haben uns unsere Apfeltalker tolle Fotos zur Abstimmung eingesandt. Welches ist Euer Favorit? Stimmt mit ab! Hier geht es zur Abstimmung --> Klick
  • Es ist bereits Apfeltalk-Tradition und wir möchten sie auch in diesem Jahr fortsetzen: Unser Apfeltalk-Weihnachtslogo-Wettbewerb hat begonnen! Gestaltet für uns das Weihnachtsbanner, das im Monat Dezember bis zum Weihnachtsfest unsere Webseite schmücken soll. Lasst Eurer Kreativität freien Lauf! Hier geht es zum Wettbewerb --> Klick

App crash auf iPhone aber keine Fehlermeldung!

Starter256

Golden Delicious
Registriert
16.02.12
Beiträge
6
Hallo

Ich hab folgendes Problem ich hab mir ein einfaches Bilder Scroll Tutorial genommen und angepasst funktioniert im Simulator ohne Probleme und keine Fehler Meldung. Nun versuch ich es mit mein iPhone 3GS da läuft es ein paar mal dann Crash aber gibt keine Fehlermeldung. Hier ist der Code für den Bilder Scroller vielleicht überseh ich was hoffe ihr könnt mir weiter helfen.

Erster Teil:

Code:
- ([COLOR=#b41ca4]void[/COLOR])layoutScrollImages{
    
[COLOR=#7134aa]    UIImageView[/COLOR] *view = [COLOR=#b41ca4]nil[/COLOR];
   [COLOR=#7134aa]NSArray[/COLOR] *subviews = [[COLOR=#568187]sv[/COLOR] [COLOR=#401082]subviews[/COLOR]];
    [COLOR=#000000]
[/COLOR]    [COLOR=#7134aa]CGFloat[/COLOR] curXLoc = [COLOR=#3d02d9]0[/COLOR];
    [COLOR=#b41ca4]for[/COLOR] (view [COLOR=#b41ca4]in[/COLOR] subviews)
    {
        [COLOR=#b41ca4]if[/COLOR] ([view [COLOR=#401082]isKindOfClass[/COLOR]:[[COLOR=#7134aa]UIImageView[/COLOR] [COLOR=#401082]class[/COLOR]]] && view.[COLOR=#7134aa]tag[/COLOR] > [COLOR=#3d02d9]0[/COLOR])
        {
            [COLOR=#7134aa]CGRect[/COLOR] frame = view.[COLOR=#7134aa]frame[/COLOR];
            frame.[COLOR=#7134aa]origin[/COLOR] = [COLOR=#401082]CGPointMake[/COLOR](curXLoc, [COLOR=#3d02d9]0[/COLOR]);
            view.[COLOR=#7134aa]frame[/COLOR] = frame;
            
            curXLoc += ([COLOR=#3d02d9]480.0[/COLOR]);
        }
    }
    [COLOR=#000000]
[/COLOR][COLOR=#401082][COLOR=#000000]    [[/COLOR][COLOR=#568187]sv[/COLOR]setContentSize[COLOR=#000000]:[/COLOR]CGSizeMake[COLOR=#000000](([/COLOR][COLOR=#3d02d9]22[/COLOR][COLOR=#000000] * [/COLOR][COLOR=#3d02d9]480.0[/COLOR][COLOR=#000000]), [[/COLOR][COLOR=#568187]sv[/COLOR]bounds[COLOR=#000000]].[/COLOR][COLOR=#7134aa]size[/COLOR][COLOR=#000000].[/COLOR][COLOR=#7134aa]height[/COLOR][COLOR=#000000])];[/COLOR][/COLOR]
    
}

Zweiter Teil:

Code:
- ([COLOR=#b41ca4]void[/COLOR])viewDidLoad{
[COLOR=#401082][COLOR=#000000]    [[/COLOR][COLOR=#b41ca4]super[/COLOR]viewDidLoad[COLOR=#000000]];[/COLOR][/COLOR]
    
[COLOR=#401082][COLOR=#b41ca4]    self[/COLOR][COLOR=#000000].[/COLOR][COLOR=#7134aa]view[/COLOR][COLOR=#000000].[/COLOR][COLOR=#7134aa]backgroundColor[/COLOR][COLOR=#000000] = [[/COLOR][COLOR=#7134aa]UIColor[/COLOR]viewFlipsideBackgroundColor[COLOR=#000000]];[/COLOR][/COLOR]
    
[COLOR=#401082][COLOR=#000000]    [[/COLOR][COLOR=#568187]sv[/COLOR]setBackgroundColor[COLOR=#000000]:[[/COLOR][COLOR=#7134aa]UIColor[/COLOR]blackColor[COLOR=#000000]]];[/COLOR][/COLOR]
[COLOR=#401082][COLOR=#000000]    [[/COLOR][COLOR=#568187]sv[/COLOR]setCanCancelContentTouches[COLOR=#000000]:[/COLOR][COLOR=#b41ca4]NO[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
[COLOR=#401082][COLOR=#568187]   sv[/COLOR][COLOR=#000000].[/COLOR][COLOR=#7134aa]indicatorStyle[/COLOR][COLOR=#000000] = [/COLOR]UIScrollViewIndicatorStyleWhite[COLOR=#000000];[/COLOR][/COLOR]
[COLOR=#1a8600][COLOR=#568187]   sv[/COLOR][COLOR=#000000].[/COLOR][COLOR=#7134aa]clipsToBounds[/COLOR][COLOR=#000000] = [/COLOR][COLOR=#b41ca4]YES[/COLOR][COLOR=#000000];        [/COLOR][/COLOR]
[COLOR=#7134aa][COLOR=#568187]   sv[/COLOR][COLOR=#000000].[/COLOR]scrollEnabled[COLOR=#000000] = [/COLOR][COLOR=#b41ca4]YES[/COLOR][COLOR=#000000];[/COLOR][/COLOR]
    
[COLOR=#7134aa][COLOR=#568187]   sv[/COLOR][COLOR=#000000].[/COLOR]pagingEnabled[COLOR=#000000] = [/COLOR][COLOR=#b41ca4]YES[/COLOR][COLOR=#000000];[/COLOR][/COLOR]
    
[COLOR=#7134aa] NSUInteger[COLOR=#000000] i;[/COLOR][/COLOR]
    [COLOR=#b41ca4]for[/COLOR] (i = [COLOR=#3d02d9]1[/COLOR]; i <= [COLOR=#3d02d9]22[/COLOR]; i++)
    {
        [COLOR=#7134aa]NSString[/COLOR] *imageName = [[COLOR=#7134aa]NSString[/COLOR] [COLOR=#401082]stringWithFormat[/COLOR]:[COLOR=#c72c25]@"XFBild%d.jpg"[/COLOR], i];
        [COLOR=#7134aa]UIImage[/COLOR] *image = [[COLOR=#7134aa]UIImage[/COLOR] [COLOR=#401082]imageNamed[/COLOR]:imageName];
        [COLOR=#7134aa]UIImageView[/COLOR] *imageView = [[[COLOR=#7134aa]UIImageView[/COLOR] [COLOR=#401082]alloc[/COLOR]] [COLOR=#401082]initWithImage[/COLOR]:image];
        
        [COLOR=#7134aa]CGRect[/COLOR] rect = imageView.[COLOR=#7134aa]frame[/COLOR];
        rect.[COLOR=#7134aa]size[/COLOR].[COLOR=#7134aa]height[/COLOR] = [COLOR=#3d02d9]320.0[/COLOR];
        rect.[COLOR=#7134aa]size[/COLOR].[COLOR=#7134aa]width[/COLOR] = [COLOR=#3d02d9]480.0[/COLOR];
        imageView.[COLOR=#7134aa]frame[/COLOR] = rect;
        imageView.[COLOR=#7134aa]tag[/COLOR] = i;    
        [[COLOR=#568187]sv[/COLOR] [COLOR=#401082]addSubview[/COLOR]:imageView];
        [imageView [COLOR=#401082]release[/COLOR]];
    }
    
[COLOR=#37595d][COLOR=#000000]    [[/COLOR][COLOR=#b41ca4]self[/COLOR]layoutScrollImages[COLOR=#000000]];    [/COLOR][/COLOR]
    
    
[COLOR=#7134aa]    UITapGestureRecognizer[COLOR=#000000] *gesture = [[[/COLOR]UITapGestureRecognizer[COLOR=#401082]alloc[/COLOR][COLOR=#000000]] [/COLOR][COLOR=#401082]initWithTarget[/COLOR][COLOR=#000000]:[/COLOR][COLOR=#b41ca4]self[/COLOR][COLOR=#401082]action[/COLOR][COLOR=#000000]:[/COLOR][COLOR=#b41ca4]@selector[/COLOR][COLOR=#000000](toggleNavBar:)];[/COLOR][/COLOR]
    [[COLOR=#b41ca4]self[/COLOR].[COLOR=#7134aa]view[/COLOR] [COLOR=#401082]addGestureRecognizer[/COLOR]:gesture];        
}
 
Ohne Fehlermeldung crashed eigentlich nix.

Speicherproblem?

Alex
 
Hi below

Hmm komisch diesmal hat er mir eine Fehlermeldung gebracht letztes mal keine aber du hattest Received memory warning Level = 1. Ach ja ich muss vorher noch erklären das ich 3 solcher ViewController in meiner App habe für unterschiedliche Kategorien der Bilder. Wo ist blos der Fehler ich geb den Speicher der ScrollView und ImageView frei beim wechseln des ViewController oder über seh ich was.