4

Question of interest: How does UILabel vertically center its text?

Initially I added a lot of context: what classes I was dealing with, what my problem with them was, what I had already tried to resolve those issues... all leading up to a very simple question: in fact so simple one could put it in a single line of text.

As you can tell by the amount of comments and downvoted / deleted answers, many people failed to understand what I was really looking for, even though I was very clear about my actual question at the very bottom (see revision 1).

After a discussion with a more experienced user a completely revamped my question to only focus on my core question and add little to no detail afterwards.

Now I am wondering: what is the correct way to ask questions? Should I

  • keep it as precise as possible to reduce noise?
  • add as much context as possible to keep the problem applicable to a large audience?
5
  • The first one. Also see this blog post on asking questions
    – codeMagic
    Commented Jun 17, 2015 at 15:31
  • @codeMagic So you'd say my question is in better shape now than it initially was? Commented Jun 17, 2015 at 15:32
  • Possibly but still seems to have a lot of noise. Explain why you want to know the answer but your opinions on agreement/disagreement with others and how Apple does things seems unnecessary and diverted my attention from the actual problem
    – codeMagic
    Commented Jun 17, 2015 at 15:34
  • @codeMagic The reason why is because of my disagreement with Apple's implementation. Commented Jun 17, 2015 at 15:37
  • "What is the correct way to ask questions". The people who wrote the rather extensive "help" section of the site are probably crying right about now. stackoverflow.com/help
    – Gimby
    Commented Jun 17, 2015 at 15:38

2 Answers 2

7

even though I was very clear about my actual question at the very bottom

Well there's your problem. It's not so much that you included additional context, it's that you included it in such a way as to obscure your actual question, rather than to supplement it.

You should be working to get to your actual question as quickly as possible, rather than forcing the reader to read through lots and lots of possibly but not necessarily relevant context just to figure out what your real problem is(thus allowing them to determine what additional context they actually need to read to answer that question).

If you have information that might be necessary for additional context beyond the actual question being asked, you need to work to make it clear to the reader where that context is, so they can read it if they feel they need to, but they can skip it if they're able to answer the question after just reading the core question alone.

You may wish to restate your actual question at the end, if you really have a lot of added context, just because some people will skip to the end of a long question to look for what's actually being asked, but you shouldn't force you readers to do this by only stating your question at the end of a rather long question.

2
  • 3
    As the first few lines comprise the excerpt shown when searching, that's an additional good reason to get to the point there, and only elaborate later. Commented Jun 17, 2015 at 15:48
  • A useful structure for factual writing in general: en.wikipedia.org/wiki/Inverted_pyramid
    – jonrsharpe
    Commented Jun 17, 2015 at 15:48
5

You want to keep it as simple as possible yet give enough detail so users can understand exactly what you are trying to achieve. Make sure to read Jon Skeet's blogpost about asking questions and the Help Center about asking a good question

Maybe this will make it more clear about the things I mentioned removing in comments. These are my personal views on your current post

I would remove

I initially thought it would be bad to have a 500 bounty question as a one liner, so here's some context:

This has no bearing on the post itself.

I would remove

Please note again that you don't have to agree with me on whether or not Apple does a good job of centering the text. It is in no correlation to my question. It is as simple as

along with the redundant question just below that text. This again really has no bearing on it. Or shouldn't, anyway. You have already explained why.

So your question would read something like...

There has been a lot of confusion about what I am actually trying to achieve. So please let me reword my question. It is as simple as:

How does Apple center text inside UILabel's -drawTextInRect:?

  • I am not happy with how Apple centers text inside this method
  • I have my own algorithm that does the job as I want

However, there are some places I can't inject this algorithm into, not even with method swizzling. Getting to know the exact algorithm they use (or an equivalent of that) would solve my personal problem.

Here's a demo project you can experiment with. In case you're interested what my problem with Apple's implementation is, look at the left side (base UILabel): The text jumps up and down as you increase the font size using the slider, instead of gradually moving downwards.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .