In my application I have an array of strings that I am trying to draw in a pop over. Previously, I have been able to draw images in the pop over, but trying to convert this to show text I have not been successful. Listed below is the function I just to get the images from the array, and draw them.
CGRect b = self.bounds;
CGFloat columnWidth = b.size.width / columnCount;
CGFloat rowHeight = b.size.height / rowCount;
for (NSUInteger rowIndex = 0; rowIndex < rowCount; rowIndex++) {
for (NSUInteger columnIndex = 0; columnIndex < columnCount; columnIndex++) {
CGRect r = CGRectMake(b.origin.x + columnIndex * columnWidth,
b.origin.y + rowIndex * rowHeight,
columnWidth, rowHeight);
UIImage *image = [self.colors objectAtIndex:rowIndex * columnCount + columnIndex];
[image drawInRect:r];
}
}
In this function (for the text, not the one above), the row and column count have sometimes changes - for the text display, columns is always 1, and the rows are always equal to the amount of items in the array (for our testing purposes, there is 1 string in the array currently) I have tried to make the image a UIlabel instead, and changing the test of the label to the item in the string - but it still does not display when using drawInRect. Does anyone have a solution to this? I basically need to find any way to draw this text in the rect, even if its not using a label and another method (like placing the text in an image, which I also was not able to figure out). Thanks for your help.