What if I can only afford one, you ask? Well, that becomes difficult, because these two books have little overlap. One is a general visitor's guide and the other is a field guide and which one you want depends a little on your knowledge, background and goals. If you already sort of know your way around Yosemite, then you'll want the Laws book. If you don't know Yosemite and aren't that interested in identifying flowers and bugs, you'll want the Medley book.
Steve Medley, Complete Visitor's Guide to Yosemite.
Medley's Complete Guidebook to Yosemite National Park is probably the best-selling Yosemite book of all time. Now in it's fifteenth edition, it is compact yet comprehensive, all written in the witty engaging style of the late Steve Medley, director of the Yosemite Association until his death in a car accident in 2006. This book gives a nice, relatively up-to-date overview of the park, from how to find the visitor center to a brief discussion of the flora and geology of the park. Yes, of course, it's superficial, but it's really the only book that puts it all together in one place and at a reasonable cost and size. It's well-worth acquiring the book a few weeks ahead of your visit and taking some time to read through it before you come to the park.
John Muir Laws, The Laws Field Guide to the Sierra Nevada.
Laws Field Guide is the book as far as I'm concerned. In 366 pages, John Muir Laws has packed in 2700 color illustrations of 1700 species of plants, insects, mamals, fish, birds and so forth. Granted, it's only the 1700 most common species, but I think that's enough to get started with. Laws has become a bit of a local hero since this book came out. Not only is it that good, but he also did all of the illustrations himself, in the vast majority of cases from live field observations. It's also filled with little nuggets of natural history that go a bit beyond just identifying species. For example, you can learn from Laws (p. 103) that "Shooting Stars are 'buzz pollinated.' Bees grab the anthers and vibrate their wing muscles at a frequency that shakes the pollen loose. Listen carefully to these pollinating bees. You can hear the change in frequency!" Though mostly oriented at identifications, each page has a little tidbit like that at the top to expand your natural history knowledge. Cool stuff!
This is the first book I've ever found that has earned a frequent place in my backpack. I don't carry trail guides ever and don't carry field guides that often, but this one has become an indispensable walking companion.