2016-05-03 10 views
0

Momentan kann ich alle Fotos auf die Seite laden, sie werden jedoch alle in der Mitte der App übereinander geladen. Ich möchte, dass die Bilder vor den Daten angezeigt werden, zu denen sie gehören.Wie man Fotos in Daten in einem Textfeld organisiert?

Zum Beispiel:

[Foto]

Name:

Geschlecht:

Alter:

[Foto]

Name:

Geschlecht:

Alter:

...

Dies ist mein Code zur Zeit (Daten aus XML-URL geladen), und ich habe bei rect und anderen Eigenschaften suchen versucht, aber ich habe nicht vermocht, etwas Glück haben.

repeat for each line tChild in tChildren 
    add 1 to x 
    put revXMLChildNames(tInfo, "ArrayOfXmlNode/"&tChild&backslash, return, "adoptableSearch", true) into tAdoptable 

    put revXMLNodeContents(tInfo, "ArrayOfXmlNode/"&tChild&"/"&tAdoptable&"/Photo") into tURL 
    put url tUrl into tPhoto 
    if the result is empty then 
    set the text of img x to tPhoto 
    else 
    beep 
    end if 

    put "Name: " & revXMLNodeContents(tInfo, "ArrayOfXmlNode/"&tChild&"/"&tAdoptable&"/Name") & return after tData 
    ... 
end repeat 

Vielen Dank im Voraus für jede Hilfe!

Antwort

0

Da Sie keine Bilder in Ihrem Code erstellt haben, nehme ich an, dass Sie sie vor der Wiederholungsschleife erstellt haben, dann müssen Sie die Größe und Position des Bildes festlegen.

Mein anderer Vorschlag ist, eine Vorlagengruppe mit einem Bild und einem oder mehreren Feldern (Name, Geschlecht, Alter usw.) zu erstellen. Sie können dann für jedes Teil ein schönes Layout erstellen. Wenn Sie fertig sind, können Sie alles innerhalb der Gruppe sperren, aber immer noch leicht den Ort für die komplette Gruppe festlegen. Schließlich können Sie die Vorlagengruppe dann außerhalb der Karte verschieben oder ausblenden.

put 50 into tTop 
put 20 into tLeft 
put the width of group "templateGroup" into tTempGW 
put the height of group "templateGroup" into tTempGH 
put 0 into tCount 
repeat for each line tChild in tChildren 
    copy group "templateGroup" to this card 
    put it into tGroupID   # It holds the long id after a copy operation 
    put url tUrl into tPhoto 
    if the result is empty then 
    set the text of img 1 of tGroupID to tPhoto 
    else 
    beep 
    end if 
    # Position the new group 
    set the topLeft of tGroupID to tLeft,tTop 
    add tTempGW to tLeft 
    if tLeft + tTempGW > the width of this stack then 
    # Next item will be partly outside so we move down 
    add tTempGH to tTop 
    put 20 into tLeft 
    end if 
    # Set some proper name 
    add 1 to tCount 
    set the name of tGroupID to ("Person" && tCount) 
    put revXMLNodeContents(tInfo, "ArrayOfXmlNode/"&tChild&"/"&tAdoptable&"/Name") into field "name" of tGroupID 
    ... 
end repeat 

Sie können natürlich auch andere Werte für oben und links verwenden. Normalerweise verwende ich eine leere Gruppe, um alle anderen Gruppen zu halten, dann benutze ich die Grenzen für diese Gruppe als oben, links, rechts.

Verwandte Themen