I have a UITableView which does not take the whole space on the screen. There are no separator lines between the list items. However there is a light grey line above the whole table which I can't get rid of.
In the image below the line is visible, and underneath there are 2 list items containing only the text "testing". Please advice how to get rid of the line above the table. Thank you!
Can you try the line tableView.backgroundColor = [UIColor clearColor]; for me?
Related
By default when I call matplotlib legend the output is:
But in my case, I want the text to have the color of the line and I want to remove the line of the legend.
Desired outcome:
How can I do this?
Partial sucess
My searches only allowed me to get the text with the correct colors
and puting those lines transparent
But there is still space on the legend box.
Is there a way to make this?
I ended up finding the answer:
When you call the legend add these properties
ax.legend(handlelength=0, handletextpad=0)
Those lines are called handles, and you set their length to 0 and with no pad between them and the text.
My aim is to create an UICollectionView with different cell sizes and all cells "fit in". There should be no empty place around the cells.
Here is an image of my Demo Application:
The sizes of t he Cells are quarter, quaver and semiquaver (1/4, 1/8 and 1/16).
So how can i realize that? How can i delete the white space around the cells to push them all together to get a look like mosaic?
thanks for your help,
brush51
Take a look at RFQuiltLayout https://github.com/bryceredd/RFQuiltLayout it is exactly what you need.
Of the several questions I have reviewed here on the subject of changing font colors, I assume there is no way to do this, but I will try again.
I start with a fresh copy of the MasterDetail template in xcode. The array to be loaded onto the Master view is defined as NSMutableArray *_objects;
I replace the statement that normally inserts the date/time into the row with statements to put in a sentence, "Help me display this in red as shown below:
//[_objects insertObject:[NSDate date] atIndex:0]; // removed this line and replaced with next two.
NSString *loadme = [[NSString alloc] initWithFormat:#"Help me display this in red"];
[_objects insertObject:loadme atIndex:0];
So, the question is, how would I change the display of this row on the Master view with red text? thanks for your time and expertise.
Since I think the answer to the above question is that it can't be done. Can you tell me how to put an image on the row before the text. That would be an even better solution. I suspect it has something to do with UITableViewCell, but i have no experience in this area.
There are a couple of ways that you could make this work. One, as per the comment from #CarlVeazey is to use NSAttributedString (like this) so that you can store the text and the colour together.
Another option would be to have another array where you add the colour (UIColor instances) and then when you prepare the cell you can set the label text and textColor from the two arrays.
I have a UILabel with the lineBreakMode set to UILineBreakModeWordWrap. This works fine, except when I have a long slab of text with no spaces. In this case it does not wrap the long slab of text but instead just cuts it off once it reaches the right-hand end of the UILabel frame. How can I tell the UILabel that it should wrap on a character boundary in this situation only (essentially equivalent to the UILineBreakModeCharacterWrap setting, but only for those long slabs of spaceless text).
Thanks in advance!
For anyone else having this same issue, I ended-up solving it by using a UITextView instead of a UILabel. This was the best solution for two reasons:
It doesn't require any custom behaviour to determine whether the text contains spaces and change the line break mode of the UILabel to/from word/character wrap.
More importantly, there is an edge case whereby you may have normal words (that you want to wrap on word boundaries) plus extra long text (which you need to wrap on character boundaries). Short of writing some kind of logic to insert a space into that extra long text (at the correct position) to force a "fake word wrap" I can't see any way to handle wrapping on words and characters, depending on the situation, within the one UILabel. The UITextView handles this situation automatically, breaking on word boundaries or character boundaries as necessary.
For specifics on how I am doing this, I have a one line UITextView with editing and scrolling disabled. I also set the .contentInset to remove the padding making it look (to the unsuspecting eye) just like a UILabel. I am then using the sizeWithFont:constrainedToSize:lineBreakMode: method to determine the frame of the rendered text, and adjusting the frame of the UITextView accordingly so that it exactly fits the text.
Hope that this helps!
One way to do this is to set the Lines property in IB.
or from code do this -
textLabel.lineBreakMode = UILineBreakModeWordWrap;
textLabel.numberOfLines = 3;
So when you set the number of lines as 3 the text wraps till that many lines are occupied.
You have to do it yourself, there's no option for 'use word wrapping except when I don't want you to' :)
If a word was too long you could insert spaces into it before you display it to help the label know where to wrap?
dean is right. If you want it you have to do it manually. The below will code will wordwrap a label even though it doesn't spaces. This may help
NSString *someText = yourLabel.text;
//Check if the text contains spaces
//The method in the below if condition is user defined and you have to define one. lol
if(![self textContainsSpaces:someText])
{
//Do the word wrap manually
CGSize constraintSize;
constraintSize.width = 165;
constraintSize.height = 165;
CGSize stringSize =[someText sizeWithFont: [UIFont boldSystemFontOfSize: 17] constrainedToSize: constraintSize lineBreakMode: UILineBreakModeWordWrap];
CGRect rect = CGRectMake(yourLabel.frame.origin.x, yourLabel.frame.origin.y, 165, (stringSize.height+10));
yourLabel.frame = rect;
}
I've got a UITableView filled with UITableViewCells.
Now when I scroll down, there's a problem with the two bottom cells. The last cell shows up as the third from the bottom and there are two additional cells below which shouldn't be there.
What are possible causes of such a behavior?
Editor's note: I hope I correctly interpreted the question. The problem could also be that the last two cells don't show up at all.
The number of cells in the table view stems from the delegate method numberOfRowsInSection:. Check what number is being set here, if you're counting an array then NSLog the count ([MyArray count]) and check to see if its as you expect. Its the only thing I can think of that would lead to additional or missing cells in your tableview without source code