This project is the "beginning iOS8 programming with Swift" project learning note = = "All Notes directory
--------------------------------------------------------------------------------------------------------------- ---
The settings for the self Sizing cell typically have the following three main steps:
Find the DetailView interface and add the auto layout constraint to the prototype cell
Specify TableView's Estimated row height
Set row height to uitableviewautomaticdimention
1. Modify Locaiton in restaurant to full name (with a long name, so that one line does not appear):
var restaurants =[Restaurant (Name:"Cafe deadend", type:"Coffee & Tea Shop", Location:"g/f, Po Hing Fong, Sheung Wan, Hong Kong", Image:"cafedeadend.jpg", isvisited:false), Restaurant (name:"Homei", type:"Cafe", Location:"Shop B, g/f, 22-24a Tai Ping San Street SOHO, Sheung Wan, Hong Kong", Image:"homei.jpg", isvisited:false), Restaurant (name:"Teakha", type:"Tea House", Location:"Shop B, Tai Ping Shan Road SOHO, Sheung Wan, Hong Kong", Image:"teakha.jpg", isvisited:false), Restaurant (name:"Cafe LOISL", type:"austrian/causual Drink", Location:"Shop B, Tai Ping Shan Road SOHO, Sheung Wan, Hong Kong", Image:"cafeloisl.jpg", isvisited:false), Restaurant (name:"Petite Oyster", type:"French", Location:"Tai Ping Shan Road SOHO, Sheung Wan, Hong Kong", Image:"petiteoyster.jpg", isvisited:false), Restaurant (name:"For Kee Restaurant", type:"Bakery", Location:"Shop J-k, Hollywood Road, SOHO, Sheung Wan, Hong Kong", Image:"forkeerestaurant.jpg", isvisited:false), Restaurant (name:"Po ' s Atelier", type:"Bakery", Location:"g/f, Hing Fong, Sheung Wan, Hong Kong", Image:"posatelier.jpg", isvisited:false), Restaurant (name:"Bourke Street backery", type:"Chocolate", Location:"633 Bourke St Sydney New South Wales Surry Hills", Image:"bourkestreetbakery.jpg", isvisited:false), Restaurant (name:"Haigh ' s chocolate", type:"Cafe", Location:"412-414 George St Sydney New South Wales", Image:"haighschocolate.jpg", isvisited:false), Restaurant (name:"Palomino Espresso", type:"American/seafood", Location:"Shop 1-York St Sydney New South Wales", Image:"palominoespresso.jpg", isvisited:false), Restaurant (name:"Upstate", type:"American", Location:"1st Ave New York, NY 10003", Image:"upstate.jpg", isvisited:false), Restaurant (name:"Traif", type:"American", Location:"229 S 4th St Brooklyn, NY 11211", Image:"traif.jpg", isvisited:false), Restaurant (name:"Graham Avenue Meats", type:"Breakfast & Brunch", Location:"445 Graham Ave Brooklyn, NY 11211", Image:"grahamavenuemeats.jpg", isvisited:false), Restaurant (name:"Waffle & Wolf", type:"Coffee & Tea", Location:"413 Graham Ave Brooklyn, NY 11211", Image:"wafflewolf.jpg", isvisited:false), Restaurant (name:"Five Leaves", type:"Coffee & Tea", Location:"Bedford Ave Brooklyn, NY 11222", Image:"fiveleaves.jpg", isvisited:false), Restaurant (name:"Cafe Lore", type:"Latin American", Location:"Sunset Park 4601 4th Ave Brooklyn, NY 11220", Image:"cafelore.jpg", isvisited:false), Restaurant (name:"Confessional", type:"Spanish", Location:"308 E 6th St New York, NY 10003", Image:"confessional.jpg", isvisited:false), Restaurant (name:"Barrafina", type:"Spanish", Location:"Frith Street London w1d 4SL Kingdom", Image:"barrafina.jpg", isvisited:false), Restaurant (name:"Donostia", type:"Spanish", Location:"Ten Seymour Place London w1h 7ND Kingdom", Image:"donostia.jpg", isvisited:false), Restaurant (name:"Royal Oak", type:"British", Location:"2 Regency Street London sw1p 4BZ Kingdom", Image:"royaloak.jpg", isvisited:false), Restaurant (name:"Thai Cafe", type:"Thai", Location:"Charlwood Street London sw1v 2DY Pimlico", Image:"thaicafe.jpg", isvisited:false) ]
2. Set the two label controls for the table in the detail view horizontally, thename is 9 points from the left margin, The value is 87 points from the left margin, and the right margin is 10 points (preferably Reset to Suggested constrain).
3. In the viewdidloaded method of detail:
36.0= uitableviewautomaticdimension
4. Select the Value Label and set the number of rows to 0, otherwise the line will not wrap.
Similarly, the controls in the restaurant controller are set.
:
Eighth chapter Self Sizing cell