ios - How to select correct image depending on size -
i have collection view cells different sizes. these cells shall populated images downloaded. images in cells looks nice, want ensure images big plenty (in terms of width x height cell).
my process that, looks kind of ugly , wanted inquire if there smarter way?
basically following:
the size of cells stored in array, e.g. arraycellsizes cgsize. i fetch images web , store in dictonary, e.g. dictwithimages. now iterate through dictwithimages for-loop, extract height , compare against the height of current cell, from arraycellsizes. the width of image in 99% of cases greater width of cell, no need check. if find image greater in height, it selected current cell and entry of dictwithimages removed, ensure image not selected sec time.this looks kind of ugly me. has theoretically issue, no perfect image found cell, have set image smaller width cell.
edit: looks nsfetchedresultscontroller answer. have dig it.
cheers -- jerik
ios objective-c collections compare uicollectionview
No comments:
Post a Comment