{"id":1425,"date":"2014-08-18T12:26:06","date_gmt":"2014-08-18T16:26:06","guid":{"rendered":"http:\/\/tim.cstj.qc.ca\/cours\/xcode\/wp\/?page_id=1425"},"modified":"2014-08-18T12:26:06","modified_gmt":"2014-08-18T16:26:06","slug":"swift-signature-des-methodes-de-delegation-protocole","status":"publish","type":"page","link":"https:\/\/ve2cuy.com\/xcode\/swift-signature-des-methodes-de-delegation-protocole\/","title":{"rendered":"Swift &#8211; Signature des m\u00e9thodes de d\u00e9l\u00e9gation (protocole)"},"content":{"rendered":"<h1>Classe UITextField<\/h1>\n<p>&nbsp;<br \/>\nM\u00e9thode appel\u00e9e suite \u00e0 un clic sur la touche &lsquo;enter&rsquo;.<\/p>\n<pre class=\"lang:swift decode:true\">func textFieldShouldReturn(textField:UITextField) -&gt; Bool{\n  return true\n}\n<\/pre>\n<p>&nbsp;<br \/>\nM\u00e9thodes appel\u00e9es suite \u00e0 r\u00e9ception ou \u00e0 la perte du focus.<\/p>\n<pre class=\"lang:swift decode:true\">\/\/ R\u00e9ception du focus - first responder\nfunc textFieldDidBeginEditing(textField:UITextField) {\n  println(\"textFieldDidBeginEditing\")\n  textField.textColor = UIColor.redColor()\n}\n\/\/ Perte de focus\nfunc textFieldDidEndEditing(textField:UITextField) {\n  println(\"textFieldDidEndEditing\")\n  textField.textColor = UIColor.blackColor()\n}<\/pre>\n<p>&nbsp;<\/p>\n<h1>Classe UITableView<\/h1>\n<p>&nbsp;<\/p>\n<pre class=\"lang:swift decode:true \">\/\/ Appel\u00e9e \u00e0 la cr\u00e9ation de la table\nfunc tableView(tableView: UITableView,  numberOfRowsInSection: NSInteger) -&gt; Int    {\n   return tableau.count\n} \/\/ numberOfRowsInSection\n\/\/ Appel\u00e9e \u00e0 chaque fois qu'une cellule est affich\u00e9e\nfunc tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell!  {\n         return uneCellule\n} \/\/ cellForRowAtIndexPath\n<\/pre>\n<p>&nbsp;<br \/>\n<a href=\"https:\/\/developer.apple.com\/library\/prerelease\/ios\/documentation\/UIKit\/Reference\/UIKit_Framework\/index.html#protocols\">R\u00e9f\u00e9rence Apple<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Classe UITextField &nbsp; M\u00e9thode appel\u00e9e suite \u00e0 un clic sur la touche &lsquo;enter&rsquo;. func textFieldShouldReturn(textField:UITextField) -&gt; Bool{ return true } &nbsp; M\u00e9thodes appel\u00e9es suite \u00e0 r\u00e9ception ou \u00e0 la perte du focus. \/\/ R\u00e9ception du focus &#8211; first responder func textFieldDidBeginEditing(textField:UITextField) { println(\u00ab\u00a0textFieldDidBeginEditing\u00a0\u00bb) textField.textColor = UIColor.redColor() } \/\/ Perte de focus func textFieldDidEndEditing(textField:UITextField) { println(\u00ab\u00a0textFieldDidEndEditing\u00a0\u00bb) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1425","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ve2cuy.com\/xcode\/wp-json\/wp\/v2\/pages\/1425","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ve2cuy.com\/xcode\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ve2cuy.com\/xcode\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ve2cuy.com\/xcode\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ve2cuy.com\/xcode\/wp-json\/wp\/v2\/comments?post=1425"}],"version-history":[{"count":0,"href":"https:\/\/ve2cuy.com\/xcode\/wp-json\/wp\/v2\/pages\/1425\/revisions"}],"wp:attachment":[{"href":"https:\/\/ve2cuy.com\/xcode\/wp-json\/wp\/v2\/media?parent=1425"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}