tag:blogger.com,1999:blog-46023163384388066512024-03-18T00:39:49.383-07:00Mobile and Social Network TechnologyThis blog talks about iOS,Android,Mac,Cocoa,use of social networks, tips and tricks which can be used by you.Reetu Rajhttp://www.blogger.com/profile/08458984428135077241noreply@blogger.comBlogger229125tag:blogger.com,1999:blog-4602316338438806651.post-16463501925463543982012-12-12T14:14:00.000-08:002012-12-12T14:14:05.003-08:00Textfield on cocos2d Mac<div dir="ltr" style="text-align: left;" trbidi="on">
Surprisingly adding a textfield in cocos2d Mac isn't as simple as in cocos2d iOS. There are various suggestions by other coders on how to do this.<br />
<br />
This sample code tells you one of the several ways to deal with the textfield in cocos2d Mac.<br />
<a href="http://dl.dropbox.com/u/1396078/TextfieldProject.zip">HERE is the download link.</a><br />
<br />
<br />
In this sample code, I have created an external window which opens up when the user hits the textfield.<br />
Here is the UserInterface of nib file. (<i>TextFieldView.xib</i>).<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-tqFaKW7muvU/UMj-CVeBGuI/AAAAAAAADtA/ueDQFp7E-wU/s1600/Screen+Shot+2012-12-12+at+5.14.47+PM.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="173" src="http://3.bp.blogspot.com/-tqFaKW7muvU/UMj-CVeBGuI/AAAAAAAADtA/ueDQFp7E-wU/s320/Screen+Shot+2012-12-12+at+5.14.47+PM.png" width="320" /></a></div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
We have following connections on this window.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixR3yRnrzqgfin2oJeXIfgfZ_hW2YBCpL97WyQzE6crfoQ8tUq2UbTXOVUR4JpHz8XsdkauqXcGDATvjJwri4ihR-Wt4dZomBKRMbctzh4sXVS9BkiCTHAsHZzgdsdrKHlmKj6u_mIqA/s1600/Screen+Shot+2012-12-12+at+5.21.10+PM.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixR3yRnrzqgfin2oJeXIfgfZ_hW2YBCpL97WyQzE6crfoQ8tUq2UbTXOVUR4JpHz8XsdkauqXcGDATvjJwri4ihR-Wt4dZomBKRMbctzh4sXVS9BkiCTHAsHZzgdsdrKHlmKj6u_mIqA/s1600/Screen+Shot+2012-12-12+at+5.21.10+PM.png" /></a></div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
When I run the app, my window looks like following with textfield which is actually a touch responsive <span class="Apple-style-span" style="color: #3e8388; font-family: Menlo; font-size: 11px;">CCMenuItemImage</span> and on top of it sits a <span class="Apple-style-span" style="color: #3e8388; font-family: Menlo; font-size: 11px;">CCLabelTTF </span>which says Enter UserName. This string"Enter UserName" will be changed to whatever user enters in the Textfield popup.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-RpbLa338lnQ/UMj-C7pNSqI/AAAAAAAADtI/Rlwgmay1T-8/s1600/Screen+Shot+2012-12-12+at+5.15.04+PM.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-RpbLa338lnQ/UMj-C7pNSqI/AAAAAAAADtI/Rlwgmay1T-8/s1600/Screen+Shot+2012-12-12+at+5.15.04+PM.png" /></a></div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
When I click on the Enter Username with my mouse, it opens the popup with the textfield. Following code is executed to make the window pop up:<br />
<br />
<br />
<div style="color: #3e8388; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> </span>TextfieldProjectAppDelegate<span style="color: black;">* appDelegate = (</span>TextfieldProjectAppDelegate<span style="color: black;">*)[[</span><span style="color: #7e1bad;">NSApplication</span><span style="color: black;"> </span><span style="color: #490084;">sharedApplication</span><span style="color: black;">] </span><span style="color: #490084;">delegate</span><span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: normal normal normal 11px/normal Menlo; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span style="color: #3e8388;">tView</span><span style="color: black;"> = [[</span><span style="color: #3e8388;">TextFieldView</span><span style="color: black;"> </span><span class="Apple-style-span" style="color: #490084;">alloc</span><span style="color: black;">] </span><span class="Apple-style-span" style="color: #490084;">initWithWindowNibName</span><span style="color: black;">:</span><span style="color: #e30009;">@"TextFieldView"</span><span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7f4627;">assert</span> ([appDelegate <span style="color: #235a5e;">window</span>]);</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7f4627;">assert</span> ([<span style="color: #3e8388;">tView</span> <span style="color: #490084;">window</span>]);</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="color: #490084; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> [</span><span style="color: #7e1bad;">NSApp</span><span style="color: black;"> </span>beginSheet<span style="color: black;">:[</span><span style="color: #3e8388;">tView</span><span style="color: black;"> </span>window<span style="color: black;">]</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #490084;">modalForWindow</span>:[appDelegate <span style="color: #235a5e;">window</span>]</div>
<div style="color: #490084; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> </span>modalDelegate<span style="color: black;">:</span><span style="color: #ce00a4;">self</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #490084;">didEndSelector</span>:<span style="color: #ce00a4;">@selector</span>(usernameSheetDidEnd:returnCode:contextInfo:)</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #490084;">contextInfo</span>:<span style="color: #ce00a4;">NULL</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-SPDya2bitvk/UMj-Du_9UJI/AAAAAAAADtQ/mLXQEGWBV3o/s1600/Screen+Shot+2012-12-12+at+5.15.13+PM.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-SPDya2bitvk/UMj-Du_9UJI/AAAAAAAADtQ/mLXQEGWBV3o/s1600/Screen+Shot+2012-12-12+at+5.15.13+PM.png" /></a></div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
We also need to define a selector which is where the control comes back when the popup is gone, hence we implement the following:<br />
<br />
<br />
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
- (<span style="color: #ce00a4;">void</span>)usernameSheetDidEnd:(<span style="color: #7e1bad;">NSWindow</span> *)sheet returnCode:(<span style="color: #7e1bad;">NSInteger</span>)returnCode contextInfo:(<span style="color: #ce00a4;">void</span> *)contextInfo {</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[sheet <span style="color: #490084;">orderOut</span>:<span style="color: #ce00a4;">nil</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="color: #e30009; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> </span><span style="color: #490084;">NSLog</span><span style="color: black;">(</span>@"name == %@"<span style="color: black;">, </span><span style="color: #3e8388;">tView</span><span style="color: black;">.</span><span style="color: #3e8388;">username</span><span style="color: black;">);</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="color: #008c00; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> </span>//Need to update text on textfield</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #3e8388;">CCLabelTTF</span> *userName=(<span style="color: #3e8388;">CCLabelTTF</span>*)[<span style="color: #ce00a4;">self</span> <span style="color: #235a5e;">getChildByTag</span>:<span style="color: #4600dd;">106</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
userName.<span style="color: #7e1bad;">string</span>=<span style="color: #3e8388;">tView</span>.<span style="color: #3e8388;">username</span>;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
}</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<br />
When you are done entering the value in textfield popup, just hit the OK button. When you do that following method(implemented in <i>TextFieldView.m</i> ) is executed. This method makes the popup go away. This is the selector method attached with OK button. You can view the connections in the Xib Interface Window in Xcode (already described above).<br />
<br />
<br />
<br />
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
- (<span style="color: #ce00a4;">IBAction</span>)usernameEntered:(<span style="color: #ce00a4;">id</span>)sender {</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="color: #3e8388; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> </span>username<span style="color: black;">=[</span>nameField<span style="color: black;"> </span><span style="color: #490084;">stringValue</span><span style="color: black;">];</span></div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> [</span>NSApp<span style="color: black;"> </span><span style="color: #490084;">endSheet</span><span style="color: black;">:</span><span style="color: #ce00a4;">self</span><span style="color: black;">.</span>window<span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
}</div>
<div>
<br /></div>
</div>
<div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>Reetu Rajhttp://www.blogger.com/profile/08458984428135077241noreply@blogger.com17tag:blogger.com,1999:blog-4602316338438806651.post-84451034369397556992012-11-22T11:32:00.000-08:002012-11-22T11:32:28.089-08:00Conversion between CGPoint & NSValue (Mac)<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<br />
<u>To convert CGPoint to NSValue:</u><br />
<br />
<span style="color: #7e03af; font-family: Menlo; font-size: 11px;">NSValue </span><span style="font-family: Menlo; font-size: 11px;">value</span><span style="font-family: Menlo; font-size: 11px;">XY</span><span style="color: #490086; font-family: Menlo; font-size: 11px;"> = [</span><span style="color: #7e03af; font-family: Menlo; font-size: 11px;">NSValue</span><span style="font-family: Menlo; font-size: 11px;"> </span><span style="color: #490086; font-family: Menlo; font-size: 11px;">valueWithPoint</span><span style="font-family: Menlo; font-size: 11px;">:</span><span style="color: #490086; font-family: Menlo; font-size: 11px;">CGPointMake</span><span style="font-family: Menlo; font-size: 11px;">(X, Y)];</span><br />
<br />
<br />
<u>To retrieve CGPoint from NSValue:</u><br />
<br />
<br />
<div style="font-family: Menlo; font-size: 11px;">
<span style="color: #7e03af;">CGPoint</span> mPoint=[valueXY <span style="color: #490086;">pointValue</span>];</div>
<div style="font-family: Menlo; font-size: 11px;">
<br /></div>
<div style="font-family: Menlo; font-size: 11px;">
<br /></div>
<div style="font-family: Menlo; font-size: 11px;">
<br /></div>
<div style="font-family: Menlo; font-size: 11px;">
<br /></div>
<div style="font-family: Menlo; font-size: 11px;">
<br /></div>
</div>
<div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>Reetu Rajhttp://www.blogger.com/profile/08458984428135077241noreply@blogger.com29tag:blogger.com,1999:blog-4602316338438806651.post-1550632222272311822012-11-22T09:30:00.001-08:002012-11-22T09:37:42.999-08:00Icons for Mac App<div dir="ltr" style="text-align: left;" trbidi="on">
This article also covers how to create .icns file which is used as icon for Mac Applications.<br />
<br />
<br />
First,you need to create a folder with .iconset as suffix.<br />
This folder will have following items with the dimensions mentioned and named as per screenshot.<br />
<br />
<br />
<ul class="simple" style="background-color: white; font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: 13px; list-style: none outside; margin: 0px 0px 0px 2.5em; padding: 0px 0px 0.5em; text-align: -webkit-auto;">
<li style="margin-top: 1px;"><div style="display: inline; margin-bottom: 0.833em; margin-top: 0.667em;">
<code style="color: #666666; font-family: Courier, Consolas, monospace;">icon_16x16.png</code></div>
</li>
<li style="margin-top: 1px;"><div style="display: inline; margin-bottom: 0.833em; margin-top: 0.667em;">
<code style="color: #666666; font-family: Courier, Consolas, monospace;">icon_16x16@2x.png</code></div>
</li>
<li style="margin-top: 1px;"><div style="display: inline; margin-bottom: 0.833em; margin-top: 0.667em;">
<code style="color: #666666; font-family: Courier, Consolas, monospace;">icon_32x32.png</code></div>
</li>
<li style="margin-top: 1px;"><div style="display: inline; margin-bottom: 0.833em; margin-top: 0.667em;">
<code style="color: #666666; font-family: Courier, Consolas, monospace;">icon_32x32@2x.png</code></div>
</li>
<li style="margin-top: 1px;"><div style="display: inline; margin-bottom: 0.833em; margin-top: 0.667em;">
<code style="color: #666666; font-family: Courier, Consolas, monospace;">icon_128x128.png</code></div>
</li>
<li style="margin-top: 1px;"><div style="display: inline; margin-bottom: 0.833em; margin-top: 0.667em;">
<code style="color: #666666; font-family: Courier, Consolas, monospace;">icon_128x128@2x.png</code></div>
</li>
<li style="margin-top: 1px;"><div style="display: inline; margin-bottom: 0.833em; margin-top: 0.667em;">
<code style="color: #666666; font-family: Courier, Consolas, monospace;">icon_256x256.png</code></div>
</li>
<li style="margin-top: 1px;"><div style="display: inline; margin-bottom: 0.833em; margin-top: 0.667em;">
<code style="color: #666666; font-family: Courier, Consolas, monospace;">icon_256x256@2x.png</code></div>
</li>
<li style="margin-top: 1px;"><div style="display: inline; margin-bottom: 0.833em; margin-top: 0.667em;">
<code style="color: #666666; font-family: Courier, Consolas, monospace;">icon_512x512.png</code></div>
</li>
<li style="margin-top: 1px;"><div style="display: inline; margin-bottom: 0.833em; margin-top: 0.667em;">
<code style="color: #666666; font-family: Courier, Consolas, monospace;">icon_512x512@2x.png</code></div>
</li>
</ul>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-u2bOE88ttaA/UK5f7FRYZfI/AAAAAAAADr4/3RqXqYgWTXE/s1600/Screen+Shot+2012-11-22+at+10.30.53+AM.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-u2bOE88ttaA/UK5f7FRYZfI/AAAAAAAADr4/3RqXqYgWTXE/s1600/Screen+Shot+2012-11-22+at+10.30.53+AM.png" /></a></div>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #666666; font-family: Courier, Consolas, monospace; font-size: x-small;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<br /></div>
<div style="text-align: -webkit-auto;">
<span style="text-align: left;">You go into the directory where you saved icon.iconset folder and then run following command on Terminal to create icns file.</span></div>
<div style="text-align: -webkit-auto;">
<span style="text-align: left;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="font-family: Courier New, Courier, monospace;">> iconutil -c icns icon.iconset/</span></div>
<div style="text-align: -webkit-auto;">
<br /></div>
<div style="text-align: -webkit-auto;">
<span style="text-align: left;">This will give you a single file as output named icon.icns in the same parent directory as icon.iconset, Add this file to resources of your application. Now i</span><span style="text-align: left;">n your project, you need to update the Icon name in </span><span style="text-align: left;">Info.plist like in screenshot here.</span></div>
<div style="text-align: -webkit-auto;">
<span style="text-align: left;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="text-align: left;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-E9Yweex9Nls/UK5g0HUbcvI/AAAAAAAADsA/kIuCywDvKrQ/s1600/Screen+Shot+2012-11-22+at+10.34.12+AM.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-E9Yweex9Nls/UK5g0HUbcvI/AAAAAAAADsA/kIuCywDvKrQ/s1600/Screen+Shot+2012-11-22+at+10.34.12+AM.png" /></a></div>
<div style="text-align: -webkit-auto;">
<span style="text-align: left;"><br /></span>
<span style="text-align: left;"><br /></span>
<span style="text-align: left;"><br /></span>
<span style="text-align: left;"><br /></span>
<span style="text-align: left;"><br /></span>
<span style="text-align: left;"><br /></span>
<span style="text-align: left;"><br /></span>
<span style="text-align: left;"><br /></span>
<span style="text-align: left;">Note: Apple documents say that you can add icon.iconset folder itself to your app's resources and Xcode 4.4 automatically creates .icns file for you. It also notes that <b>"</b></span><span style="color: #cc0000;"><u><span style="background-color: white; font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: 13px; text-align: left;">Don’t use Icon Composer—it can’t create high-resolution </span><code style="background-color: white; font-family: Courier, Consolas, monospace; font-size: 13px; text-align: left;">icns</code></u></span><span style="background-color: white; font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: 13px; text-align: left;"><span style="color: #cc0000;"><u> files.</u></span>" </span><span style="text-align: left;">. </span><a href="http://developer.apple.com/library/mac/#documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Optimizing/Optimizing.html" style="text-align: left;"><span style="color: #0b5394;">HERE IS THE LINK</span></a><br />
<span style="text-align: left;"><br /></span>
<span style="text-align: left;"><br /></span></div>
</div>
<div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>Reetu Rajhttp://www.blogger.com/profile/08458984428135077241noreply@blogger.com5tag:blogger.com,1999:blog-4602316338438806651.post-12953294044484429812012-11-20T08:14:00.002-08:002012-11-20T08:20:34.805-08:00Cocos2d For Mac<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> Create a folder say(Cocos2DGame) where you want to download a copy of Cocos2d:</span></div>
<div style="text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> On your Terminal,</span><br />
<code class="bash plain" style="background-color: white; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"></code><code class="bash plain" style="background-color: white; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre; width: auto !important;"> > git clone git:</code><code class="bash plain" style="background-color: white; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre; width: auto !important;">//github</code><code class="bash plain" style="background-color: white; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre; width: auto !important;">.com</code><code class="bash plain" style="background-color: white; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre; width: auto !important;">/cocos2d/cocos2d-iphone</code><code class="bash plain" style="background-color: white; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre; width: auto !important;">.git</code></div>
<div class="line number1 index0 alt2" style="background-color: white !important; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; height: auto !important; left: auto !important; line-height: 15px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<br /></div>
<div class="line number1 index0 alt2" style="background-color: white !important; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; height: auto !important; left: auto !important; line-height: 15px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="bash plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: small; line-height: normal; white-space: normal;">After this command a copy of Cocos2d will exist in Cocos2DGame folder. You need to step into Cocos2DGame folder by doing </span></code><br />
<div>
<span style="background-color: white; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px;">>cd Cocos2DGame</span><br />
<span style="background-color: white; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 1em; line-height: 1.1em;">>git checkout develop</span></div>
</div>
<div class="line number2 index1 alt1" style="background-color: white !important; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; height: auto !important; left: auto !important; line-height: 15px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="bash plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><br /></code></div>
<div class="line number2 index1 alt1" style="background-color: white !important; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; height: auto !important; left: auto !important; line-height: 15px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="bash plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: small; line-height: normal; white-space: normal;">You need to install the cocos2d Mac Template in XCode</span></code><br />
<span style="background-color: white; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 1em; line-height: 1.1em;">>sudo ./install-templates.sh</span></div>
<div class="line number2 index1 alt1" style="background-color: white !important; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; height: auto !important; left: auto !important; line-height: 15px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="bash plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><br /></code></div>
<div class="line number2 index1 alt1" style="background-color: white !important; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; height: auto !important; left: auto !important; line-height: 15px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="background-color: transparent; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">Now when you start a new project in Xcode, you will see the installed Cocos2d for Mac .</span></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-clNpul-d0tk/UKusT0kWdYI/AAAAAAAADq4/3wlw71qPtG0/s1600/Screen+Shot+2012-11-20+at+11.13.07+AM.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="http://3.bp.blogspot.com/-clNpul-d0tk/UKusT0kWdYI/AAAAAAAADq4/3wlw71qPtG0/s1600/Screen+Shot+2012-11-20+at+11.13.07+AM.png" /></a></div>
<br />
<br />
Note: You need to install git on your Mac Machine before you can run those git commands given above.<br />
<br />
Download and Install dmg<br />
http://code.google.com/p/git-osx-installer/downloads/list<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br /></div>
<div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>Reetu Rajhttp://www.blogger.com/profile/08458984428135077241noreply@blogger.com3tag:blogger.com,1999:blog-4602316338438806651.post-18546439256717091392012-08-14T19:55:00.001-07:002012-08-17T12:10:06.421-07:00How to use NSScanner on NSString.<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
This is quiet useful in terms of parsing a simple static webpage, also pick certain kind of words from the NSString.<br />
<br />
Lets say we have following snippet from a html file.<br />
<br />
<br />
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">NSString</span> *htmlString=</div>
<br />
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br />
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<b>< div id="topLeft" class="news" style="padding-top:3px"</b></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<b>onMouseOver="style.color='white';style.backgroundColor='#F0ABFF'" onMouseOut="style.color='black';style.backgroundColor='#000000'"</b><b>></b><b><</b><b>a </b><b>style="text-decoration:none;color:black" onMouseOver="style.color='white'" onMouseOut="style.color='black'"href="reetu/test/news.htm" target="_blank"</b><b>>Latest News</b><b><</b><b>/a</b><b>></b></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<b><br /></b></div>
<b></b></div>
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span class="Apple-style-span" style="font-family: Times; font-size: small;"><br /></span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<b><span class="Apple-style-span" style="font-family: Times; font-size: small; font-weight: normal;">Now I want to extract the url, text and div id </span></b><b><span class="Apple-style-span" style="font-family: Times; font-size: small; font-weight: normal;">from this html file snippet. Following code will give you that.</span></b></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<b><span class="Apple-style-span" style="font-family: Times; font-size: small; font-weight: normal;"><br /></span></b></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<b><span class="Apple-style-span" style="font-family: Times; font-size: small; font-weight: normal;"><br /></span></b></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<b><span class="Apple-style-span" style="font-family: Times; font-size: small; font-weight: normal;"></span></b></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;"><span class="Apple-style-span" style="color: black; font-family: Verdana, sans-serif; font-size: x-small;"> </span><span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;">NSScanner</span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"> *rScanner = [<span style="color: #7e1bad;">NSScanner</span> <span style="color: #490084;">scannerWithString</span>:string];</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"> </span><span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"><span style="color: #7e1bad;">NSString</span> *divID=<span style="color: #e30009;">@""</span>;</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"> </span><span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"><span style="color: black;">[rScanner </span><span class="Apple-style-span" style="color: #351c75;">scanString</span><span style="color: black;">:</span><span style="color: #e30009;">@"<div id=\""</span><span style="color: black;"> </span><span class="Apple-style-span" style="color: #351c75;">intoString</span><span style="color: black;">:</span><span style="color: #ce00a4;">NULL</span><span style="color: black;">];</span></span></div>
<div style="font: normal normal normal 11px/normal Menlo; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<div id="\" span="span">
<div style="font: normal normal normal 11px/normal Menlo; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<div style="color: #490084;">
<span class="Apple-style-span" style="color: black; font-family: Verdana, sans-serif; font-size: x-small;"> </span><span class="Apple-style-span" style="color: black; font-family: Verdana, sans-serif; font-size: x-small;">[rScanner <span style="color: #490084;">scanUpToString</span>:<span style="color: #e30009;">@"class=\"news\""</span> <span style="color: #490084;">intoString</span>:&courseID];</span></div>
</div>
</div>
</div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"><span class="Apple-style-span">
</span>
</span><br />
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"> </span><span class="Apple-style-span" style="color: #490084; font-family: Verdana, sans-serif; font-size: x-small;"><span style="color: black;">divID=[divID </span>stringByReplacingOccurrencesOfString<span style="color: black;">:</span><span style="color: #e30009;">@" "</span><span style="color: black;"> </span>withString<span style="color: black;">:</span><span style="color: #e30009;">@""</span><span style="color: black;">];</span></span></div>
<div style="font: normal normal normal 11px/normal Menlo; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<div style="color: #490084;">
<span class="Apple-style-span" style="color: black; font-family: Verdana, sans-serif; font-size: x-small;"> </span><span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"><span style="color: black;">divID=[divID </span>stringByReplacingOccurrencesOfString<span style="color: black;">:</span><span style="color: #e30009;">@"\""</span><span style="color: black;"> </span>withString<span style="color: black;">:</span><span style="color: #e30009;">@""</span><span style="color: black;">]; </span></span></div>
<div style="color: #490084;">
<span class="Apple-style-span" style="color: black; font-family: Verdana, sans-serif; font-size: x-small;"> </span><span class="Apple-style-span" style="color: black; font-family: Verdana, sans-serif; font-size: x-small;"><span style="color: black;">divID=[divID </span><span class="Apple-style-span" style="color: #490084;">stringByReplacingOccurrencesOfString</span><span style="color: black;">:</span><span class="Apple-style-span" style="color: #cc0000;">@"<divid="</span><divid span="span"><span style="color: black;"> </span>withString<span style="color: black;">:</span><span style="color: #e30009;">@""</span><span style="color: black;">]; </span></divid></span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"><span style="color: #490084;"> NSLog</span>(<span style="color: #e30009;">@"divID=%@"</span>,</span><span class="Apple-style-span" style="color: black; font-family: Verdana, sans-serif; font-size: x-small;"><span style="color: black;">divID</span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;">);</span><span class="Apple-style-span" style="color: black; font-family: Verdana, sans-serif; font-size: x-small;"><divid span="span"><span style="color: black;"> </span></divid></span></div>
</div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"><span class="Apple-style-span">
</span><span class="Apple-style-span"></span>
</span><br />
<div style="color: #008c00; display: inline !important; font: normal normal normal 11px/normal Menlo; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"><span class="Apple-style-span">/*Instead of above 3 lines you could also do [rScanner scanUpToString: instead of scanString:</span></span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"></span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"> </span></div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"><span class="Apple-style-span">
</span>
</span><br />
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"> <span style="color: #7e1bad;">NSString</span> *rURL=<span style="color: #e30009;">@""</span>;</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"> </span><span class="Apple-style-span" style="color: #490084; font-family: Verdana, sans-serif; font-size: x-small;"><span style="color: black;">[rScanner </span>scanUpToString<span style="color: black;">:</span><span style="color: #e30009;">@"href=\""</span><span style="color: black;"> </span>intoString<span style="color: black;">:</span><span style="color: #ce00a4;">NULL</span><span style="color: black;">];</span></span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"> </span><span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;">[rScanner <span style="color: #490084;">scanUpToString</span>:<span style="color: #e30009;">@">"</span> <span style="color: #490084;">intoString</span>:&rURL];</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"> </span><span class="Apple-style-span" style="color: #490084; font-family: Verdana, sans-serif; font-size: x-small;"><span style="color: black;">rURL=[rURL </span>stringByReplacingOccurrencesOfString<span style="color: black;">:</span><span style="color: #e30009;">@"href=\""</span><span style="color: black;"> </span>withString<span style="color: black;">:</span><span style="color: #e30009;">@""</span><span style="color: black;">];</span></span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"> </span><span class="Apple-style-span" style="color: #490084; font-family: Verdana, sans-serif; font-size: x-small;"><span style="color: black;">rURL=[rURL </span>stringByReplacingOccurrencesOfString<span style="color: black;">:</span><span style="color: #e30009;">@"target=\"_blank\""</span><span style="color: black;"> </span>withString<span style="color: black;">:</span><span style="color: #e30009;">@""</span><span style="color: black;">];</span></span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"> </span><span class="Apple-style-span" style="color: #490084; font-family: Verdana, sans-serif; font-size: x-small;"><span style="color: black;">rURL=[rURL </span>stringByReplacingOccurrencesOfString<span style="color: black;">:</span><span style="color: #e30009;">@"\" "</span><span style="color: black;"> </span>withString<span style="color: black;">:</span><span style="color: #e30009;">@""</span><span style="color: black;">];</span></span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"> </span><span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"><span style="color: #490084;">NSLog</span>(<span style="color: #e30009;">@"rURL=%@"</span>,rURL);</span></div>
<span class="Apple-style-span" style="font-family: Menlo; font-size: 11px;"><span style="color: #7e1bad;"></span></span><br />
<div>
<span class="Apple-style-span" style="font-family: Menlo; font-size: 11px;"><span style="color: #7e1bad;"><span class="Apple-style-span" style="font-family: Menlo; font-size: 11px;"><span style="color: #7e1bad;"><br /></span></span></span></span></div>
<span class="Apple-style-span" style="font-family: Menlo; font-size: 11px;"><span style="color: #7e1bad;">
</span></span>
<br />
<div>
<span class="Apple-style-span" style="font-family: Menlo; font-size: 11px;"><span style="color: #7e1bad;"><span class="Apple-style-span" style="font-family: Menlo; font-size: 11px;"><span style="color: #7e1bad;"><br /></span></span></span></span></div>
<span class="Apple-style-span" style="font-family: Menlo; font-size: 11px;"><span style="color: #7e1bad;">
</span></span>
<br />
<div>
<span class="Apple-style-span" style="font-family: Menlo; font-size: 11px;"><span style="color: #7e1bad;"><span class="Apple-style-span" style="font-family: Menlo; font-size: 11px;"><span style="color: #7e1bad;"><br /></span></span></span></span></div>
<span class="Apple-style-span" style="font-family: Menlo; font-size: 11px;"><span style="color: #7e1bad;">
NSString</span> *rName=<span style="color: #e30009;">@""</span>;</span><br />
<div>
<span class="Apple-style-span" style="font-family: Menlo; font-size: 11px;"> [rScanner <span style="color: #490084;">scanUpToString</span>:<span style="color: #e30009;">@"</a>" </span><span class="Apple-style-span" style="color: #351c75;">intoString</span>:&rName];</span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"></span><span class="Apple-style-span" style="color: #490084; font-family: Verdana, sans-serif; font-size: x-small;"><span style="color: black;"> rName=[courseName </span>stringByReplacingOccurrencesOfString<span style="color: black;">:</span><span style="color: #e30009;">@">"</span><span style="color: black;"> </span>withString<span style="color: black;">:</span><span style="color: #e30009;">@""</span><span style="color: black;">];</span></span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"><span style="color: #490084;"> NSLog</span>(<span style="color: #e30009;">@"rName=%@"</span>,rName);</span><br />
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;"> </span></div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif; font-size: x-small;">
</span>
<br />
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div>
<br /></div>
<br />
<br />
<br />
It will print following results:<br />
<br />
<br />
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<b>divID=topLeft</b></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<b>rURL=reetu/test/news.htm</b></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<b>rName=Latest News</b><br />
<b><br /></b>
<b><br /></b>
<b><br /></b></div>
Read More: <a href="https://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/Strings/Articles/Scanners.html">https://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/Strings/Articles/Scanners.html </a><br />
<br />
<br /></div>
</div>
<div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>Reetu Rajhttp://www.blogger.com/profile/08458984428135077241noreply@blogger.com2tag:blogger.com,1999:blog-4602316338438806651.post-43781115614272379052012-08-01T11:50:00.002-07:002012-08-01T11:50:45.568-07:00Tips: How to find if NSDictionary has a key.<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<br />
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span class="Apple-style-span" style="color: #ce00a4;">if<span style="color: black;"> (</span></span>[[myDiction <span style="color: #490084;">allKeys</span>] <span style="color: #490084;">containsObject</span>:<span style="color: #e30009;">@"myKey"</span>])</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
</div>
<div style="color: #e30009; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> </span><span style="color: #490084;">NSLog</span><span style="color: black;">(</span>@"It contains myKey"<span style="color: black;">);</span></div>
<div style="color: #e30009; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"><br /></span></div>
<div style="color: #e30009; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"><br /></span></div>
<br />
</div><div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>Reetu Rajhttp://www.blogger.com/profile/08458984428135077241noreply@blogger.com2tag:blogger.com,1999:blog-4602316338438806651.post-523438809192029272012-07-31T22:38:00.001-07:002012-07-31T22:39:51.838-07:00How to use NSAttributedString in iOS 6<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<span class="Apple-style-span" style="color: #3e8388;">infoString</span>=<span class="Apple-style-span" style="color: red;">@"This is an example of Attributed String"</span>;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<span class="Apple-style-span" style="color: #3e8388;"><br /></span></div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
NSMutableAttributedString<span style="color: black;"> *attString=[[</span>NSMutableAttributedString<span style="color: black;"> </span><span style="color: #490084;">alloc</span><span style="color: black;">] </span><span style="color: #490084;">initWithString</span><span style="color: black;">:</span><span style="color: #3e8388;">infoString</span><span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">NSInteger</span> _stringLength=[<span style="color: #3e8388;">infoString</span> <span style="color: #490084;">length</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
UIColor<span style="color: black;"> *_black=[</span>UIColor<span style="color: black;"> </span><span style="color: #490084;">blackColor</span><span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">UIFont</span> *font=[<span style="color: #7e1bad;">UIFont</span> <span style="color: #490084;">fontWithName</span>:<span style="color: #e30009;">@"Helvetica-Bold"</span> <span style="color: #490084;">size</span>:<span style="color: #4600dd;">30.0f</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[attString <span style="color: #490084;">addAttribute</span>:<span style="color: #7e1bad;">NSFontAttributeName</span> <span style="color: #490084;">value</span>:font <span style="color: #490084;">range</span>:<span style="color: #490084;">NSMakeRange</span>(<span style="color: #4600dd;">0</span>, _stringLength)];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[attString <span style="color: #490084;">addAttribute</span>:<span style="color: #7e1bad;">NSForegroundColorAttributeName</span> <span style="color: #490084;">value</span>:_black <span style="color: #490084;">range</span>:<span style="color: #490084;">NSMakeRange</span>(<span style="color: #4600dd;">0</span>, _stringLength)];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLxJbgugEA2lXW8PS8uYEwR3X7hHY0FcbGWM-XSWC-CCyvBY6FiQ61OaXoLXab6Rl7XxfH8c0-S2w8n3VXcOgrWjlePsM0vPVLJBXvFiO0mNdOZwRq3ecGk0wp7qTFz68mUz4qUuWGWQ/s1600/NSAttributedString_Example1.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLxJbgugEA2lXW8PS8uYEwR3X7hHY0FcbGWM-XSWC-CCyvBY6FiQ61OaXoLXab6Rl7XxfH8c0-S2w8n3VXcOgrWjlePsM0vPVLJBXvFiO0mNdOZwRq3ecGk0wp7qTFz68mUz4qUuWGWQ/s1600/NSAttributedString_Example1.png" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
UIColor<span style="color: black;"> *_red=[</span>UIColor<span style="color: black;"> </span><span style="color: #490084;">redColor</span><span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">UIFont</span> *font=[<span style="color: #7e1bad;">UIFont</span> <span style="color: #490084;">fontWithName</span>:<span style="color: #e30009;">@"Helvetica-Bold"</span> <span style="color: #490084;">size</span>:<span style="color: #4600dd;">72.0f</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[attString <span style="color: #490084;">addAttribute</span>:<span style="color: #7e1bad;">NSFontAttributeName</span> <span style="color: #490084;">value</span>:font <span style="color: #490084;">range</span>:<span style="color: #490084;">NSMakeRange</span>(<span style="color: #4600dd;">0</span>, _stringLength)];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[attString <span style="color: #490084;">addAttribute</span>:<span style="color: #7e1bad;">NSStrokeColorAttributeName</span> <span style="color: #490084;">value</span>:_red <span style="color: #490084;">range</span>:<span style="color: #490084;">NSMakeRange</span>(<span style="color: #4600dd;">0</span>, _stringLength)];</div>
<span class="Apple-style-span" style="font-family: Menlo; font-size: 11px;">[attString <span style="color: #490084;">addAttribute</span>:<span style="color: #7e1bad;">NSStrokeWidthAttributeName</span> <span style="color: #490084;">value</span>:[<span style="color: #7e1bad;">NSNumber</span> <span style="color: #490084;">numberWithFloat</span>:<span style="color: #4600dd;">3.0</span>] <span style="color: #490084;">range</span>:<span style="color: #490084;">NSMakeRange</span>(<span style="color: #4600dd;">0</span>, _stringLength)];</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEht-ZREKGzhb4kfQdTrUXm72KiQfcAdFT68I8vex00GoNRjgrRB4v_eaiQHgaHEMjMxgoipNKyE8IrssSEVxi0LeOlhaa9PXuJfBpcupk78Kg0dPOQOpqOa-wcaxpWL-qJYujr3IFJXnA/s1600/NSAttributedString_Example2.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="145" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEht-ZREKGzhb4kfQdTrUXm72KiQfcAdFT68I8vex00GoNRjgrRB4v_eaiQHgaHEMjMxgoipNKyE8IrssSEVxi0LeOlhaa9PXuJfBpcupk78Kg0dPOQOpqOa-wcaxpWL-qJYujr3IFJXnA/s320/NSAttributedString_Example2.png" width="320" /></a></div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
UIColor<span style="color: black;"> *_red=[</span>UIColor<span style="color: black;"> </span><span style="color: #490084;">redColor</span><span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">UIFont</span> *font=[<span style="color: #7e1bad;">UIFont</span> <span style="color: #490084;">fontWithName</span>:<span style="color: #e30009;">@"Helvetica-Bold"</span> <span style="color: #490084;">size</span>:<span style="color: #4600dd;">72.0f</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[attString <span style="color: #490084;">addAttribute</span>:<span style="color: #7e1bad;">NSFontAttributeName</span> <span style="color: #490084;">value</span>:font <span style="color: #490084;">range</span>:<span style="color: #490084;">NSMakeRange</span>(<span style="color: #4600dd;">0</span>, _stringLength)];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[attString <span style="color: #490084;">addAttribute</span>:<span style="color: #7e1bad;">NSStrokeColorAttributeName</span> <span style="color: #490084;">value</span>:_red <span style="color: #490084;">range</span>:<span style="color: #490084;">NSMakeRange</span>(<span style="color: #4600dd;">0</span>, _stringLength)];</div>
<span class="Apple-style-span" style="font-family: Menlo; font-size: 11px;">[attString <span style="color: #490084;">addAttribute</span>:<span style="color: #7e1bad;">NSStrokeWidthAttributeName</span> <span style="color: #490084;">value</span>:[<span style="color: #7e1bad;">NSNumber</span> <span style="color: #490084;">numberWithFloat</span>:-<span style="color: #4600dd;">3.0</span>] <span style="color: #490084;">range</span>:<span style="color: #490084;">NSMakeRange</span>(<span style="color: #4600dd;">0</span>, _stringLength)];</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgy8poKUDxVqgbA5yzGjuawO0IzlkV32LCihETGl-zmRXRMXYfRhRhQz0y3FW-tpYuAg3iXXSmPmQx4V8MnqwjFLBb7mhyphenhyphenDW3pnxMqjNSqkTI9x0nqTvvRb6AszDQ03VmWI_XNmeAPy9Q/s1600/NSAttributedString_Example3.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="135" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgy8poKUDxVqgbA5yzGjuawO0IzlkV32LCihETGl-zmRXRMXYfRhRhQz0y3FW-tpYuAg3iXXSmPmQx4V8MnqwjFLBb7mhyphenhyphenDW3pnxMqjNSqkTI9x0nqTvvRb6AszDQ03VmWI_XNmeAPy9Q/s320/NSAttributedString_Example3.png" width="320" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgy8poKUDxVqgbA5yzGjuawO0IzlkV32LCihETGl-zmRXRMXYfRhRhQz0y3FW-tpYuAg3iXXSmPmQx4V8MnqwjFLBb7mhyphenhyphenDW3pnxMqjNSqkTI9x0nqTvvRb6AszDQ03VmWI_XNmeAPy9Q/s1600/NSAttributedString_Example3.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgy8poKUDxVqgbA5yzGjuawO0IzlkV32LCihETGl-zmRXRMXYfRhRhQz0y3FW-tpYuAg3iXXSmPmQx4V8MnqwjFLBb7mhyphenhyphenDW3pnxMqjNSqkTI9x0nqTvvRb6AszDQ03VmWI_XNmeAPy9Q/s1600/NSAttributedString_Example3.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgy8poKUDxVqgbA5yzGjuawO0IzlkV32LCihETGl-zmRXRMXYfRhRhQz0y3FW-tpYuAg3iXXSmPmQx4V8MnqwjFLBb7mhyphenhyphenDW3pnxMqjNSqkTI9x0nqTvvRb6AszDQ03VmWI_XNmeAPy9Q/s1600/NSAttributedString_Example3.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgy8poKUDxVqgbA5yzGjuawO0IzlkV32LCihETGl-zmRXRMXYfRhRhQz0y3FW-tpYuAg3iXXSmPmQx4V8MnqwjFLBb7mhyphenhyphenDW3pnxMqjNSqkTI9x0nqTvvRb6AszDQ03VmWI_XNmeAPy9Q/s1600/NSAttributedString_Example3.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgy8poKUDxVqgbA5yzGjuawO0IzlkV32LCihETGl-zmRXRMXYfRhRhQz0y3FW-tpYuAg3iXXSmPmQx4V8MnqwjFLBb7mhyphenhyphenDW3pnxMqjNSqkTI9x0nqTvvRb6AszDQ03VmWI_XNmeAPy9Q/s1600/NSAttributedString_Example3.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a></div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
UIColor<span style="color: black;"> *_red=[</span>UIColor<span style="color: black;"> </span><span style="color: #490084;">redColor</span><span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">UIColor</span> *_green=[<span style="color: #7e1bad;">UIColor</span> <span style="color: #490084;">greenColor</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">UIFont</span> *font=[<span style="color: #7e1bad;">UIFont</span> <span style="color: #490084;">fontWithName</span>:<span style="color: #e30009;">@"Helvetica-Bold"</span> <span style="color: #490084;">size</span>:<span style="color: #4600dd;">72.0f</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[attString <span style="color: #490084;">addAttribute</span>:<span style="color: #7e1bad;">NSFontAttributeName</span> <span style="color: #490084;">value</span>:font <span style="color: #490084;">range</span>:<span style="color: #490084;">NSMakeRange</span>(<span style="color: #4600dd;">0</span>, _stringLength)];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[attString <span style="color: #490084;">addAttribute</span>:<span style="color: #7e1bad;">NSForegroundColorAttributeName</span> <span style="color: #490084;">value</span>:_green <span style="color: #490084;">range</span>:<span style="color: #490084;">NSMakeRange</span>(<span style="color: #4600dd;">0</span>, _stringLength)];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[attString <span style="color: #490084;">addAttribute</span>:<span style="color: #7e1bad;">NSStrokeColorAttributeName</span> <span style="color: #490084;">value</span>:_red <span style="color: #490084;">range</span>:<span style="color: #490084;">NSMakeRange</span>(<span style="color: #4600dd;">0</span>, _stringLength)];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[attString <span style="color: #490084;">addAttribute</span>:<span style="color: #7e1bad;">NSStrokeWidthAttributeName</span> <span style="color: #490084;">value</span>:[<span style="color: #7e1bad;">NSNumber</span> <span style="color: #490084;">numberWithFloat</span>:-<span style="color: #4600dd;">3.0</span>] <span style="color: #490084;">range</span>:<span style="color: #490084;">NSMakeRange</span>(<span style="color: #4600dd;">0</span>, _stringLength)];</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFaucv_lKO62e2mLBPP79k6BXhve2tVVbUlqjruSboJUMmDDlDZ2uYd7Q8BazzsFM0oB6ZxYUTu6gfJOTD-OHRdefKQSjXnJg1ix5IQaXLVrinfgAIjEK-QIE1txiALje1IUtOkXvkaA/s1600/NSAttributedString_Example4.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="142" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFaucv_lKO62e2mLBPP79k6BXhve2tVVbUlqjruSboJUMmDDlDZ2uYd7Q8BazzsFM0oB6ZxYUTu6gfJOTD-OHRdefKQSjXnJg1ix5IQaXLVrinfgAIjEK-QIE1txiALje1IUtOkXvkaA/s320/NSAttributedString_Example4.png" width="320" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFaucv_lKO62e2mLBPP79k6BXhve2tVVbUlqjruSboJUMmDDlDZ2uYd7Q8BazzsFM0oB6ZxYUTu6gfJOTD-OHRdefKQSjXnJg1ix5IQaXLVrinfgAIjEK-QIE1txiALje1IUtOkXvkaA/s1600/NSAttributedString_Example4.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFaucv_lKO62e2mLBPP79k6BXhve2tVVbUlqjruSboJUMmDDlDZ2uYd7Q8BazzsFM0oB6ZxYUTu6gfJOTD-OHRdefKQSjXnJg1ix5IQaXLVrinfgAIjEK-QIE1txiALje1IUtOkXvkaA/s1600/NSAttributedString_Example4.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFaucv_lKO62e2mLBPP79k6BXhve2tVVbUlqjruSboJUMmDDlDZ2uYd7Q8BazzsFM0oB6ZxYUTu6gfJOTD-OHRdefKQSjXnJg1ix5IQaXLVrinfgAIjEK-QIE1txiALje1IUtOkXvkaA/s1600/NSAttributedString_Example4.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFaucv_lKO62e2mLBPP79k6BXhve2tVVbUlqjruSboJUMmDDlDZ2uYd7Q8BazzsFM0oB6ZxYUTu6gfJOTD-OHRdefKQSjXnJg1ix5IQaXLVrinfgAIjEK-QIE1txiALje1IUtOkXvkaA/s1600/NSAttributedString_Example4.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFaucv_lKO62e2mLBPP79k6BXhve2tVVbUlqjruSboJUMmDDlDZ2uYd7Q8BazzsFM0oB6ZxYUTu6gfJOTD-OHRdefKQSjXnJg1ix5IQaXLVrinfgAIjEK-QIE1txiALje1IUtOkXvkaA/s1600/NSAttributedString_Example4.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a></div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
UIColor<span style="color: black;"> *_green=[</span>UIColor<span style="color: black;"> </span><span style="color: #490084;">greenColor</span><span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">UIFont</span> *font=[<span style="color: #7e1bad;">UIFont</span> <span style="color: #490084;">fontWithName</span>:<span style="color: #e30009;">@"Helvetica-Bold"</span> <span style="color: #490084;">size</span>:<span style="color: #4600dd;">72.0f</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">NSShadow</span> *shadowDic=[[<span style="color: #7e1bad;">NSShadow</span> <span style="color: #490084;">alloc</span>] <span style="color: #490084;">init</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[shadowDic <span style="color: #490084;">setShadowBlurRadius</span>:<span style="color: #4600dd;">5.0</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[shadowDic <span style="color: #490084;">setShadowColor</span>:[<span style="color: #7e1bad;">UIColor</span> <span style="color: #490084;">grayColor</span>]];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[shadowDic <span style="color: #490084;">setShadowOffset</span>:<span style="color: #490084;">CGSizeMake</span>(<span style="color: #4600dd;">0</span>, <span style="color: #4600dd;">3</span>)];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[attString <span style="color: #490084;">addAttribute</span>:<span style="color: #7e1bad;">NSFontAttributeName</span> <span style="color: #490084;">value</span>:font <span style="color: #490084;">range</span>:<span style="color: #490084;">NSMakeRange</span>(<span style="color: #4600dd;">0</span>, _stringLength)];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[attString <span style="color: #490084;">addAttribute</span>:<span style="color: #7e1bad;">NSForegroundColorAttributeName</span> <span style="color: #490084;">value</span>:_green <span style="color: #490084;">range</span>:<span style="color: #490084;">NSMakeRange</span>(<span style="color: #4600dd;">0</span>, _stringLength)];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[attString <span style="color: #490084;">addAttribute</span>:<span style="color: #7e1bad;">NSShadowAttributeName</span> <span style="color: #490084;">value</span>:shadowDic <span style="color: #490084;">range</span>:<span style="color: #490084;">NSMakeRange</span>(<span style="color: #4600dd;">0</span>, _stringLength)];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD4qtQ_P_j06zz5v8gPlr4j6vn7DCEIBZbRH6qdTWMupF6zO6JqoYPktxdIn-QZqf-7mIrOROklOk5lUdfWpjx0TaBovydMQ9K7ZAL4dBIck52SHp9yW8ptjA4R5hH10PFl7epterNyQ/s1600/NSAttributedString_Example5.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD4qtQ_P_j06zz5v8gPlr4j6vn7DCEIBZbRH6qdTWMupF6zO6JqoYPktxdIn-QZqf-7mIrOROklOk5lUdfWpjx0TaBovydMQ9K7ZAL4dBIck52SHp9yW8ptjA4R5hH10PFl7epterNyQ/s1600/NSAttributedString_Example5.png" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD4qtQ_P_j06zz5v8gPlr4j6vn7DCEIBZbRH6qdTWMupF6zO6JqoYPktxdIn-QZqf-7mIrOROklOk5lUdfWpjx0TaBovydMQ9K7ZAL4dBIck52SHp9yW8ptjA4R5hH10PFl7epterNyQ/s1600/NSAttributedString_Example5.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD4qtQ_P_j06zz5v8gPlr4j6vn7DCEIBZbRH6qdTWMupF6zO6JqoYPktxdIn-QZqf-7mIrOROklOk5lUdfWpjx0TaBovydMQ9K7ZAL4dBIck52SHp9yW8ptjA4R5hH10PFl7epterNyQ/s1600/NSAttributedString_Example5.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD4qtQ_P_j06zz5v8gPlr4j6vn7DCEIBZbRH6qdTWMupF6zO6JqoYPktxdIn-QZqf-7mIrOROklOk5lUdfWpjx0TaBovydMQ9K7ZAL4dBIck52SHp9yW8ptjA4R5hH10PFl7epterNyQ/s1600/NSAttributedString_Example5.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD4qtQ_P_j06zz5v8gPlr4j6vn7DCEIBZbRH6qdTWMupF6zO6JqoYPktxdIn-QZqf-7mIrOROklOk5lUdfWpjx0TaBovydMQ9K7ZAL4dBIck52SHp9yW8ptjA4R5hH10PFl7epterNyQ/s1600/NSAttributedString_Example5.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
UIColor<span style="color: black;"> *_red=[</span>UIColor<span style="color: black;"> </span><span style="color: #490084;">redColor</span><span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">UIFont</span> *font=[<span style="color: #7e1bad;">UIFont</span> <span style="color: #490084;">fontWithName</span>:<span style="color: #e30009;">@"Helvetica-Bold"</span> <span style="color: #490084;">size</span>:<span style="color: #4600dd;">72.0f</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[attString <span style="color: #490084;">addAttribute</span>:<span style="color: #7e1bad;">NSFontAttributeName</span> <span style="color: #490084;">value</span>:font <span style="color: #490084;">range</span>:<span style="color: #490084;">NSMakeRange</span>(<span style="color: #4600dd;">0</span>, _stringLength)];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[attString <span style="color: #490084;">addAttribute</span>:<span style="color: #7e1bad;">NSForegroundColorAttributeName</span> <span style="color: #490084;">value</span>:_red <span style="color: #490084;">range</span>:<span style="color: #490084;">NSMakeRange</span>(<span style="color: #4600dd;">0</span>, _stringLength)]; </div>
<span class="Apple-style-span" style="color: #490084; font-family: Menlo; font-size: 11px;"><span style="color: black;"> [attString </span>addAttribute<span style="color: black;">:</span><span style="color: #7e1bad;">NSKernAttributeName</span><span style="color: black;"> </span>value<span style="color: black;">:[</span><span style="color: #7e1bad;">NSNumber</span><span style="color: black;"> </span>numberWithInt<span style="color: black;">:</span><span style="color: #4600dd;">5</span><span style="color: black;">] </span>range<span style="color: black;">:</span>NSMak</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfx_ZzZuhBGiy8ib_SHBUhSLNYJKebURSPgCzqK-9VUob2JGzyTCd3e0l2MeFcxIicgac5wbosvuEVyhCQ9gUTZ9uGEMbrZ7axUe655PKHSpn1Ybu6MMGpDGwiWm01DqsIPgiyhpNP8Q/s1600/NSAttributedString_Example6.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfx_ZzZuhBGiy8ib_SHBUhSLNYJKebURSPgCzqK-9VUob2JGzyTCd3e0l2MeFcxIicgac5wbosvuEVyhCQ9gUTZ9uGEMbrZ7axUe655PKHSpn1Ybu6MMGpDGwiWm01DqsIPgiyhpNP8Q/s1600/NSAttributedString_Example6.png" /></a></div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
UIColor<span style="color: black;"> *_red=[</span>UIColor<span style="color: black;"> </span><span style="color: #490084;">redColor</span><span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">UIFont</span> *font=[<span style="color: #7e1bad;">UIFont</span> <span style="color: #490084;">fontWithName</span>:<span style="color: #e30009;">@"Helvetica-Bold"</span> <span style="color: #490084;">size</span>:<span style="color: #4600dd;">30.0f</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[attString <span style="color: #490084;">addAttribute</span>:<span style="color: #7e1bad;">NSFontAttributeName</span> <span style="color: #490084;">value</span>:font <span style="color: #490084;">range</span>:<span style="color: #490084;">NSMakeRange</span>(<span style="color: #4600dd;">0</span>, _stringLength)];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[attString <span style="color: #490084;">addAttribute</span>:<span style="color: #7e1bad;">NSForegroundColorAttributeName</span> <span style="color: #490084;">value</span>:_red <span style="color: #490084;">range</span>:<span style="color: #490084;">NSMakeRange</span>(<span style="color: #4600dd;">0</span>, _stringLength)];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[attString <span style="color: #490084;">addAttribute</span>:<span style="color: #7e1bad;">NSUnderlineStyleAttributeName</span> <span style="color: #490084;">value</span>:[<span style="color: #7e1bad;">NSNumber</span> <span style="color: #490084;">numberWithInt</span>:<span style="color: #4600dd;">2</span>] <span style="color: #490084;">range</span>:<span style="color: #490084;">NSMakeRange</span>(<span style="color: #4600dd;">0</span>, _stringLength)];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-oMsKtHs9D6w/UBi-jvJCwCI/AAAAAAAADqI/dM5uf28WkNk/s1600/NSAttributedString_Example7.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-oMsKtHs9D6w/UBi-jvJCwCI/AAAAAAAADqI/dM5uf28WkNk/s1600/NSAttributedString_Example7.png" /></a></div>
<br />
<br />
<br />
<br />
<br />
<br />
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
UIColor<span style="color: black;"> *_blue=[</span>UIColor<span style="color: black;"> </span><span style="color: #490084;">blueColor</span><span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">UIColor</span> *_blueL=[<span style="color: #7e1bad;">UIColor</span> <span style="color: #490084;">colorWithRed</span>:<span style="color: #4600dd;">0</span> <span style="color: #490084;">green</span>:<span style="color: #4600dd;">0</span> <span style="color: #490084;">blue</span>:<span style="color: #4600dd;">0.5</span> <span style="color: #490084;">alpha</span>:<span style="color: #4600dd;">0.7</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">UIFont</span> *font=[<span style="color: #7e1bad;">UIFont</span> <span style="color: #490084;">fontWithName</span>:<span style="color: #e30009;">@"Helvetica-Bold"</span> <span style="color: #490084;">size</span>:<span style="color: #4600dd;">30.0f</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[attString <span style="color: #490084;">addAttribute</span>:<span style="color: #7e1bad;">NSFontAttributeName</span> <span style="color: #490084;">value</span>:font <span style="color: #490084;">range</span>:<span style="color: #490084;">NSMakeRange</span>(<span style="color: #4600dd;">0</span>, _stringLength)];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[attString <span style="color: #490084;">addAttribute</span>:<span style="color: #7e1bad;">NSForegroundColorAttributeName</span> <span style="color: #490084;">value</span>:_blue <span style="color: #490084;">range</span>:<span style="color: #490084;">NSMakeRange</span>(<span style="color: #4600dd;">0</span>, _stringLength)];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[attString <span style="color: #490084;">addAttribute</span>:<span style="color: #7e1bad;">NSBackgroundColorAttributeName</span> <span style="color: #490084;">value</span>:_blueL <span style="color: #490084;">range</span>:<span style="color: #490084;">NSMakeRange</span>(<span style="color: #4600dd;">0</span>, <span style="color: #4600dd;">20</span>)];</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqu4iq_u0ZydfNLWpynRxsEAoyyQkTrLnybB4g4YdLQegFRNXAK63rGV9_pOyFoWqxHMqVAljw8aYdGQ3vFrZdph504fS-Y-iFRA90Yj7k2V8KB2wm0K1h578k3W-EZfbYt0IzgWEjcA/s1600/NSAttributedString_Example8.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqu4iq_u0ZydfNLWpynRxsEAoyyQkTrLnybB4g4YdLQegFRNXAK63rGV9_pOyFoWqxHMqVAljw8aYdGQ3vFrZdph504fS-Y-iFRA90Yj7k2V8KB2wm0K1h578k3W-EZfbYt0IzgWEjcA/s1600/NSAttributedString_Example8.png" /></a></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
</div><div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>Reetu Rajhttp://www.blogger.com/profile/08458984428135077241noreply@blogger.com289tag:blogger.com,1999:blog-4602316338438806651.post-46933161100110580462012-07-26T21:36:00.003-07:002012-07-26T21:36:52.518-07:00Tips: Hide scrollbars of UIScrollView<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="color: #3f1281; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"><br /></span></div>
<div style="color: #3f1281; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"><br /></span></div>
<div style="color: #3f1281; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;">[</span><span style="color: #538187;">mScrollView</span><span style="color: black;"> </span>setShowsHorizontalScrollIndicator<span style="color: black;">:</span><span style="color: #b70ea3;">NO</span><span style="color: black;">];</span></div>
<div style="color: #3f1281; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;">[</span><span style="color: #538187;">mScrollView</span><span style="color: black;"> </span>setShowsVerticalScrollIndicator<span style="color: black;">:</span><span style="color: #b70ea3;">NO</span><span style="color: black;">];</span></div>
<div style="color: #3f1281; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"><br /></span></div>
<div style="color: #3f1281; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"><br /></span></div>
</div><div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>Reetu Rajhttp://www.blogger.com/profile/08458984428135077241noreply@blogger.com2tag:blogger.com,1999:blog-4602316338438806651.post-11641003712604936362012-07-24T20:44:00.002-07:002012-07-24T20:45:27.368-07:00How to animate a line draw ?<div dir="ltr" style="text-align: left;" trbidi="on">
If you want to draw a line pixel by pixel.<br />
You will have to use combination of <span class="Apple-style-span" style="color: #7e1bad; font-family: Menlo; font-size: 11px;">UIBezierPath,</span><span class="Apple-style-span" style="color: #7e1bad; font-family: Menlo; font-size: 11px;"> CAShapeLayer,</span><span class="Apple-style-span" style="color: #7e1bad; font-family: Menlo; font-size: 11px;"> CABasicAnimation.</span> You can <span class="Apple-style-span" style="color: #0b5394;"><u><a href="http://dl.dropbox.com/u/1396078/AnimateLine.zip">download the code here</a></u>. </span>The piece of code given below animates a simple line drawn pixel by pixel from point <span class="Apple-style-span" style="color: #490084; font-family: Menlo; font-size: 11px;"><span style="color: black;">(</span><span style="color: #4600dd;">50.0</span><span style="color: black;">,</span><span style="color: #4600dd;">0.0</span><span style="color: black;">) </span></span>to point <span class="Apple-style-span" style="color: #490084; font-family: Menlo; font-size: 11px;"><span style="color: black;">(</span><span style="color: #4600dd;">120.0</span><span style="color: black;">, </span><span style="color: #4600dd;">600.0</span><span style="color: black;">).</span></span><br />
<br />
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> </span>UIBezierPath<span style="color: black;"> *path = [</span>UIBezierPath<span style="color: black;"> </span><span style="color: #490084;">bezierPath</span><span style="color: black;">];</span></div>
<div style="color: #490084; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> [path </span>moveToPoint<span style="color: black;">:</span>CGPointMake<span style="color: black;">(</span><span style="color: #4600dd;">50.0</span><span style="color: black;">,</span><span style="color: #4600dd;">0.0</span><span style="color: black;">)];</span></div>
<div style="color: #490084; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> [path </span>addLineToPoint<span style="color: black;">:</span>CGPointMake<span style="color: black;">(</span><span style="color: #4600dd;">120.0</span><span style="color: black;">, </span><span style="color: #4600dd;">600.0</span><span style="color: black;">)];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> </span>CAShapeLayer<span style="color: black;"> *pathLayer = [</span>CAShapeLayer<span style="color: black;"> </span><span style="color: #490084;">layer</span><span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
pathLayer.<span style="color: #7e1bad;">frame</span> = <span style="color: #ce00a4;">self</span>.<span style="color: #7e1bad;">view</span>.<span style="color: #7e1bad;">bounds</span>;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
pathLayer.<span style="color: #7e1bad;">path</span> = path.<span style="color: #7e1bad;">CGPath</span>;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
pathLayer.<span style="color: #7e1bad;">strokeColor</span> = [[<span style="color: #7e1bad;">UIColor</span> <span style="color: #490084;">redColor</span>] <span style="color: #490084;">CGColor</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
pathLayer.<span style="color: #7e1bad;">fillColor</span> = <span style="color: #ce00a4;">nil</span>;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
pathLayer.<span style="color: #7e1bad;">lineWidth</span> = <span style="color: #4600dd;">2.0f</span>;</div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> pathLayer.</span>lineJoin<span style="color: black;"> = </span>kCALineJoinBevel<span style="color: black;">;</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[<span style="color: #ce00a4;">self</span>.<span style="color: #7e1bad;">view</span>.<span style="color: #7e1bad;">layer</span> <span style="color: #490084;">addSublayer</span>:pathLayer];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> </span>CABasicAnimation<span style="color: black;"> *pathAnimation = [</span>CABasicAnimation<span style="color: black;"> </span><span style="color: #490084;">animationWithKeyPath</span><span style="color: black;">:</span><span style="color: #e30009;">@"strokeEnd"</span><span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
pathAnimation.<span style="color: #7e1bad;">duration</span> = <span style="color: #4600dd;">2.0</span>;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
pathAnimation.<span style="color: #7e1bad;">fromValue</span> = [<span style="color: #7e1bad;">NSNumber</span> <span style="color: #490084;">numberWithFloat</span>:<span style="color: #4600dd;">0.0f</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
pathAnimation.<span style="color: #7e1bad;">toValue</span> = [<span style="color: #7e1bad;">NSNumber</span> <span style="color: #490084;">numberWithFloat</span>:<span style="color: #4600dd;">1.0f</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[pathLayer <span style="color: #490084;">addAnimation</span>:pathAnimation <span style="color: #490084;">forKey</span>:<span style="color: #e30009;">@"strokeEnd"</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
</div><div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>Reetu Rajhttp://www.blogger.com/profile/08458984428135077241noreply@blogger.com0tag:blogger.com,1999:blog-4602316338438806651.post-27506195364487382892012-07-21T23:30:00.001-07:002012-07-21T23:30:25.775-07:00convert NSArray in float[]<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="font: normal normal normal 11px/normal Menlo; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span style="color: #7e1bad;"> NSArray</span><span style="color: black;"> *c=[</span><span class="Apple-style-span" style="color: #7e1bad;">NSArray</span><span style="color: black;"> </span><span class="Apple-style-span" style="color: #490084;">arrayWithObjects</span><span style="color: black;">:</span><span style="color: #e30009;">@"1"</span>,<span class="Apple-style-span" style="color: #e30009;">@"8"</span>,<span class="Apple-style-span" style="color: #e30009;">@"4"</span>,<span class="Apple-style-span" style="color: #e30009;">@"2"</span>,<span class="Apple-style-span" style="color: #ce00a4;">nil</span><span class="Apple-style-span" style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
NSEnumerator *enumerator;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #ce00a4;">float</span> * cArray;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #ce00a4;">id</span> obj;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #ce00a4;">int</span> index=<span style="color: #4600dd;">0</span>;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
cArray = (<span style="color: #ce00a4;">float</span> *) <span style="color: #490084;">malloc</span>(<span style="color: #ce00a4;">sizeof</span>(<span style="color: #ce00a4;">float</span>) * [c <span style="color: #490084;">count</span>]);</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
enumerator = [c <span style="color: #490084;">objectEnumerator</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span class="Apple-style-span"> <span style="color: #ce00a4;">while</span>(</span>obj<span class="Apple-style-span"> = [enumerator <span style="color: #490084;">nextObject</span>])</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
{</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span class="Apple-style-span"> </span>cArray<span class="Apple-style-span">[index] = [</span>obj<span class="Apple-style-span"> <span style="color: #490084;">floatValue</span>];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
index++;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
}</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="color: #490084; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> </span></div>
<div style="color: #490084; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"><br /></span></div>
<div style="color: #490084; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"><br /></span></div>
</div><div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>Reetu Rajhttp://www.blogger.com/profile/08458984428135077241noreply@blogger.com4tag:blogger.com,1999:blog-4602316338438806651.post-50886223724509182392012-07-19T16:56:00.003-07:002012-07-19T17:08:06.779-07:00Ad Hoc Build in XCode 4.3+ and XCode 4.5<div dir="ltr" style="text-align: left;" trbidi="on">
Things have changed a little bit for ad hoc. This post is for people who may face problem while trying to create adhoc. While trying to install .ipa on device through iTunes, it gives error <span style="color: red;">"iTunes sync failed to start"</span><br />
<br />
Make sure your mobile provisioning for ad-hoc and distribution certificate is installed before we proceed any further. You can go through<u> <a href="http://soulwithmobiletechnology.blogspot.com/2011/03/how-to-create-distribution-build-with.html">my old post</a>,</u> it is very detailed, just to refresh things like how to create certificate and other required things.<br />
<br />
Note: You can read captions on the image for more clarity.<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-z2I3uqUxrBs/UAib8pi6Z_I/AAAAAAAADmE/1OJyHmMxX04/s1600/Ad+Hoc+1.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="294" src="http://4.bp.blogspot.com/-z2I3uqUxrBs/UAib8pi6Z_I/AAAAAAAADmE/1OJyHmMxX04/s640/Ad+Hoc+1.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="color: #741b47; text-align: center;">Add Ad Hoc configuration by duplicating release (You can do that by pressing + sign)</td><td class="tr-caption" style="text-align: center;">)</td></tr>
</tbody></table>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br /><br />
<br />
<br />
<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-h2mMDdpzr7o/UAib-sb75kI/AAAAAAAADmk/FdIA0Z_NBk4/s1600/Ad+Hoc+2.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="262" src="http://2.bp.blogspot.com/-h2mMDdpzr7o/UAib-sb75kI/AAAAAAAADmk/FdIA0Z_NBk4/s640/Ad+Hoc+2.png" width="640" /></a></td></tr>
<tr style="color: #741b47;"><td class="tr-caption" style="text-align: center;">You need to add distribution signing profile for Ad Hoc as well as <b>Release</b>.</td></tr>
</tbody></table>
<br /><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-BufmQIGKmMk/UAib-z_SRjI/AAAAAAAADms/a7PKPsJmudw/s1600/Ad+Hoc+3.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-BufmQIGKmMk/UAib-z_SRjI/AAAAAAAADms/a7PKPsJmudw/s1600/Ad+Hoc+3.png" /></a></td></tr>
<tr style="color: #741b47;"><td class="tr-caption" style="text-align: center;">Now on top left corner of your XCode screen. Click on project Name like here I click on MIMChartLIb</td></tr>
</tbody></table>
<br /><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-34HbsqCVlx4/UAib_E7vjwI/AAAAAAAADm0/Mz-ZkSSsQPM/s1600/Ad+Hoc+4.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-34HbsqCVlx4/UAib_E7vjwI/AAAAAAAADm0/Mz-ZkSSsQPM/s1600/Ad+Hoc+4.png" /></a></td></tr>
<tr style="color: #741b47;"><td class="tr-caption" style="text-align: center;">I get popup like this.Click on Edit Scheme.</td></tr>
</tbody></table>
<br /><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-EYX9TkCmcqE/UAib_llgLvI/AAAAAAAADm8/oK_XKQqwo1w/s1600/Ad+Hoc+5.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-EYX9TkCmcqE/UAib_llgLvI/AAAAAAAADm8/oK_XKQqwo1w/s1600/Ad+Hoc+5.png" /></a></td></tr>
<tr style="color: #741b47;"><td class="tr-caption" style="text-align: center;">Go to Archieve(Highlighted cell on left tableview). On right side,Change Build Configuration to Ad Hoc.Click OK.</td></tr>
</tbody></table>
<br /><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br /><br />
<br />
<br />
<br />
<br /><br />
<br />
<br />
<br />
<br /><br />
<br />
<br />
<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-yIev7hosb2Q/UAib_4bsfHI/AAAAAAAADnE/uaPCJ1oxu4o/s1600/Ad+Hoc+6.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-yIev7hosb2Q/UAib_4bsfHI/AAAAAAAADnE/uaPCJ1oxu4o/s1600/Ad+Hoc+6.png" /></a></td></tr>
<tr style="color: #741b47;"><td class="tr-caption" style="text-align: center;">Now go to Product > Archive</td></tr>
</tbody></table>
<br /><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br /><br />
<br />
<br />
<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-1j3g53lu2dI/UAicAZsrfCI/AAAAAAAADnM/LNq7yq1syI0/s1600/Ad+Hoc+7.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-1j3g53lu2dI/UAicAZsrfCI/AAAAAAAADnM/LNq7yq1syI0/s1600/Ad+Hoc+7.png" /></a></td></tr>
<tr style="color: #741b47;"><td class="tr-caption" style="text-align: center;">It will ask you to sign with keys. Click Allow or Always Allow.</td></tr>
</tbody></table>
<br /><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjP82ZXLpV3OQpZlLeiiZdqIh_xtpb653REJroNjVwl5nLujB71IkPBBKunmaLGGZwtjLEZnIaqcqUCgTg2Qpt0mHKSC4q9XOESUeQR5e3wu2nG0yVM7YE7zwjw-Z6tLySwF62HzB8H7Q/s1600/Ad+Hoc+8.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="353" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjP82ZXLpV3OQpZlLeiiZdqIh_xtpb653REJroNjVwl5nLujB71IkPBBKunmaLGGZwtjLEZnIaqcqUCgTg2Qpt0mHKSC4q9XOESUeQR5e3wu2nG0yVM7YE7zwjw-Z6tLySwF62HzB8H7Q/s640/Ad+Hoc+8.png" width="640" /></a></td></tr>
<tr style="color: #741b47;"><td class="tr-caption" style="text-align: center;">After sometime, Organiser window will open displaying Archive. If not, You can open Organiser from Xcode Menu: Window>Organiser.</td></tr>
</tbody></table>
<br /><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br /><br />
<br />
<br />
<br />
<br /><br />
<br />
<br />
<br />
<br /><br />
<br />
<br />
<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-DAKSeIgan08/UAicCbfB0rI/AAAAAAAADnc/bPoyct34Pl0/s1600/Ad+Hoc+9.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-DAKSeIgan08/UAicCbfB0rI/AAAAAAAADnc/bPoyct34Pl0/s1600/Ad+Hoc+9.png" /></a></td></tr>
<tr style="color: #741b47;"><td class="tr-caption" style="text-align: center;">Clicking on Distribute button on previous screen, opens this. Choose second option here.</td></tr>
</tbody></table>
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-2gNfqf-tK6o/UAib84Y11nI/AAAAAAAADmM/a8JtwgWLOAY/s1600/Ad+Hoc+10.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-2gNfqf-tK6o/UAib84Y11nI/AAAAAAAADmM/a8JtwgWLOAY/s1600/Ad+Hoc+10.png" /></a></td></tr>
<tr style="color: #741b47;"><td class="tr-caption" style="text-align: center;">Next it asks for Code Signing Identity, Choose your Ad-Hoc distribution profile.</td></tr>
</tbody></table>
<br /><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br /><br />
<br />
<br />
<br />
<br /><br />
<br />
<br />
<br />
<br /><br />
<br />
<br />
<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-ed513zY4dfc/UAib9lTHIXI/AAAAAAAADmU/azG-H2ppe7E/s1600/Ad+Hoc+11.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-ed513zY4dfc/UAib9lTHIXI/AAAAAAAADmU/azG-H2ppe7E/s1600/Ad+Hoc+11.png" /></a></td></tr>
<tr style="color: #741b47;"><td class="tr-caption" style="text-align: center;">It will ask you to sign with the key Click Allow or Always Allow.</td></tr>
</tbody></table>
<br /><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br /><br />
<br />
<br />
<br />
<br /><br />
<br />
<br />
<br />
<br /><br />
<br />
<br />
<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-Z9byh9aK880/UAib-LtemEI/AAAAAAAADmc/68x9q4OE2jQ/s1600/Ad+Hoc+12.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-Z9byh9aK880/UAib-LtemEI/AAAAAAAADmc/68x9q4OE2jQ/s1600/Ad+Hoc+12.png" /></a></td></tr>
<tr style="color: #741b47;"><td class="tr-caption" style="text-align: center;">After sometime, it will ask you where to save your .ipa file. Thats it ! You select your location and click Save.</td></tr>
</tbody></table>
</div><br /><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br /><br />
<br />
<br />
<br />
<br /><br />
<br />
<br />
<br />
<br /><br />
<br />
<br />
<br />
<br />
<br /><div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>Reetu Rajhttp://www.blogger.com/profile/08458984428135077241noreply@blogger.com3tag:blogger.com,1999:blog-4602316338438806651.post-68292850488228372662012-07-17T15:11:00.003-07:002012-07-17T15:11:24.741-07:00Tutorial: How to use QLPreviewController to preview files.<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
This tutorial will talk about implementation of preview feature of documents, images and files available on iOS 4.0 onwards. Apple reference document says:<br />
<br />
<span class="Apple-style-span" style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: 13px;"></span><br />
<div style="font: normal normal normal 100%/normal 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; margin-bottom: 0.833em; margin-top: 0px;">
A Quick Look preview controller can display previews for the following items:</div>
<ul class="ul" style="list-style-image: initial; list-style-position: outside; list-style-type: disc; margin-bottom: 0.833em; margin-left: 1.35em; margin-right: 0px; margin-top: 0px; padding-bottom: 0.5em; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<li class="li" style="margin-top: 0.583em;"><div style="display: inline; font: normal normal normal 100%/normal 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; margin-bottom: 0.833em; margin-top: 0.667em;">
iWork documents</div>
</li>
<li class="li" style="margin-top: 0.583em;"><div style="display: inline; font: normal normal normal 100%/normal 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; margin-bottom: 0.833em; margin-top: 0.667em;">
Microsoft Office documents (Office ‘97 and newer)</div>
</li>
<li class="li" style="margin-top: 0.583em;"><div style="display: inline; font: normal normal normal 100%/normal 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; margin-bottom: 0.833em; margin-top: 0.667em;">
Rich Text Format (RTF) documents</div>
</li>
<li class="li" style="margin-top: 0.583em;"><div style="display: inline; font: normal normal normal 100%/normal 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; margin-bottom: 0.833em; margin-top: 0.667em;">
PDF files</div>
</li>
<li class="li" style="margin-top: 0.583em;"><div style="display: inline; font: normal normal normal 100%/normal 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; margin-bottom: 0.833em; margin-top: 0.667em;">
Images</div>
</li>
<li class="li" style="margin-top: 0.583em;"><div style="display: inline; font: normal normal normal 100%/normal 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; margin-bottom: 0.833em; margin-top: 0.667em;">
Text files whose uniform type identifier (UTI) conforms to the <code style="color: #666666; font-family: Courier, Consolas, monospace; font-size: 13px;">public.text</code> type (see <em style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: 13px; font-style: italic;"><a href="http://developer.apple.com/library/ios/documentation/Miscellaneous/Reference/UTIRef/Introduction/Introduction.html#//apple_ref/doc/uid/TP40009257" style="color: #3366cc; text-decoration: none;" target="_self">Uniform Type Identifiers Reference</a></em>)</div>
</li>
<li class="li" style="margin-top: 0.583em;"><div style="display: inline; font: normal normal normal 100%/normal 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; margin-bottom: 0.833em; margin-top: 0.667em;">
Comma-separated value (csv) files</div>
</li>
</ul>
<br />
<br />
You need to add QuickLook.framework in your project. and import QuickLook/QuickLook.h<br />
and add protocols <span class="Apple-style-span" style="color: #7e1bad; font-family: Menlo; font-size: 11px;"><span style="color: black;"><</span>QLPreviewControllerDataSource<span style="color: black;">,</span>QLPreviewControllerDelegate<span style="color: black;">></span></span><br />
<span class="Apple-style-span" style="color: #7e1bad; font-family: Menlo; font-size: 11px;"><span style="color: black;"><br /></span></span><br />
<span class="Apple-style-span" style="color: #7e1bad; font-family: Menlo; font-size: 11px;"><span style="color: black;"><br /></span></span><br />
<br />
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
QLPreviewController<span style="color: black;"> *previewController=[[</span>QLPreviewController<span style="color: black;"> </span><span style="color: #490084;">alloc</span><span style="color: black;">]</span><span style="color: #490084;">init</span><span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
previewController.<span style="color: #7e1bad;">delegate</span>=<span style="color: #ce00a4;">self</span>;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
previewController.<span style="color: #7e1bad;">dataSource</span>=<span style="color: #ce00a4;">self</span>;</div>
<div style="color: #490084; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;">[</span><span style="color: #ce00a4;">self</span><span style="color: black;"> </span>presentModalViewController<span style="color: black;">:previewController </span>animated<span style="color: black;">:</span><span style="color: #ce00a4;">YES</span><span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[previewController.<span style="color: #7e1bad;">navigationItem</span> <span style="color: #490084;">setRightBarButtonItem</span>:<span style="color: #ce00a4;">nil</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<span class="Apple-style-span" style="font-family: Times; font-size: small;">You need to add datasource methods for sure. Return more than 1 for </span>numberOfPreviewItemsInPreviewController<span class="Apple-style-span" style="font-family: Times; font-size: small;"> if you want user to be able to preview next and previous file while in preview mode. Else return 1 if you want user to exclusively preview only selected file.</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
- (<span style="color: #7e1bad;">NSInteger</span>)numberOfPreviewItemsInPreviewController:(<span style="color: #7e1bad;">QLPreviewController</span> *)controller</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
- (<span style="color: #ce00a4;">id</span> <<span style="color: #7e1bad;">QLPreviewItem</span>>)previewController:(<span style="color: #7e1bad;">QLPreviewController</span> *)controller previewItemAtIndex:(<span style="color: #7e1bad;">NSInteger</span>)index</div>
<br />
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<span class="Apple-style-span" style="font-family: Times; font-size: small;">You may add delegate methods optionally depending on your requirements. In Sample code, I have used these delegate methods to add the zooming effect where the preview seems to come out of the same button clicked by user.</span></div>
<br />
<br />
<br />
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
- (<span style="color: #ce00a4;">BOOL</span>)previewController:(<span style="color: #7e1bad;">QLPreviewController</span> *)controller shouldOpenURL:(<span style="color: #7e1bad;">NSURL</span> *)url forPreviewItem:(<span style="color: #ce00a4;">id</span> <<span style="color: #7e1bad;">QLPreviewItem</span>>)item</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
- (<span style="color: #7e1bad;">CGRect</span>)previewController:(<span style="color: #7e1bad;">QLPreviewController</span> *)controller frameForPreviewItem:(<span style="color: #ce00a4;">id</span> <<span style="color: #7e1bad;">QLPreviewItem</span>>)item inSourceView:(<span style="color: #7e1bad;">UIView</span> **)view</div>
<div>
<br /></div>
<div>
<br /></div>
<br />
For more information, you can view the<a href="http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Reference/QLPreviewController_Class/Reference/Reference.html"><u> Apple reference document.</u></a><br />
<br />
<a href="http://dl.dropbox.com/u/1396078/QLPreviewSample.zip">Link of the sample code to download.</a></div><div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>Reetu Rajhttp://www.blogger.com/profile/08458984428135077241noreply@blogger.com15tag:blogger.com,1999:blog-4602316338438806651.post-36678709296564704992012-07-17T10:23:00.000-07:002012-07-17T10:24:17.582-07:00Make a difference with your App.<div dir="ltr" style="text-align: left;" trbidi="on">
This is a great video inspiring the developers to make an app which actually makes a difference ! <a href="http://www.apple.com/ios/videos/#developers">LINK</a><br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.apple.com/ios/videos/#developers" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="401" src="http://4.bp.blogspot.com/-ZdBLa3N48Zk/UAWfQTKUyKI/AAAAAAAADl0/c6RtqjqpxCg/s640/Screen+Shot+2012-07-17+at+1.24.42+PM.png" width="640" /></a></div>
<br />
<br /></div><div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>Reetu Rajhttp://www.blogger.com/profile/08458984428135077241noreply@blogger.com0tag:blogger.com,1999:blog-4602316338438806651.post-76886995057999890642012-07-16T17:34:00.003-07:002012-07-16T17:35:57.847-07:00Importance of SLComposeViewControllerCompletionHandler<div dir="ltr" style="text-align: left;" trbidi="on">
You need to add the handler(<span class="Apple-style-span" style="color: #351c75; font-family: Menlo; font-size: 11px;">SLComposeViewControllerCompletionHandler</span>) otherwise you may get following error when you try to cancel the Facebook Post or post the Post:<br />
<br />
<span class="Apple-style-span" style="color: red;">viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceErrorDomain Code =1 "The operation couldn't be completed. (_UIViewServiceErrorDomain error 1.)"</span><br />
<br />
<br />
You need to create handler like following<br />
<br />
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
SLComposeViewControllerCompletionHandler <span style="color: #ce00a4;">__block</span> completionHandler=^(<span style="color: #7e1bad;">SLComposeViewControllerResult</span> result)</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
{</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="color: #490084; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> [fbController </span>dismissViewControllerAnimated<span style="color: black;">:</span><span style="color: #ce00a4;">YES</span><span style="color: black;"> </span>completion<span style="color: black;">:</span><span style="color: #ce00a4;">nil</span><span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #ce00a4;">switch</span>(result){</div>
<div style="color: #490084; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> </span><span style="color: #ce00a4;">case</span><span style="color: black;"> </span>SLComposeViewControllerResultCancelled<span style="color: black;">:</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #ce00a4;">default</span>:</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
{</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #490084;">NSLog</span>(<span style="color: #e30009;">@"Cancelled....."</span>);</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
}</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #ce00a4;">break</span>;</div>
<div style="color: #490084; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> </span><span style="color: #ce00a4;">case</span><span style="color: black;"> </span>SLComposeViewControllerResultDone<span style="color: black;">:</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
{</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #490084;">NSLog</span>(<span style="color: #e30009;">@"Posted...."</span>);</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
}</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #ce00a4;">break</span>;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
}};</div>
<br />
<br />
and add this handler to SLComposeViewController<br />
<br />
<br />
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
SLComposeViewController<span style="color: black;"> *fbController=[</span>SLComposeViewController<span style="color: black;"> </span><span style="color: #490084;">composeViewControllerForServiceType</span><span style="color: black;">:</span>SLServiceTypeFacebook<span style="color: black;">];</span></div>
<div>
<span class="Apple-style-span" style="font-family: Menlo; font-size: 11px;">[fbController </span><span class="Apple-style-span" style="font-family: Menlo; font-size: 11px;"><span style="color: #490084;">setCompletionHandler</span></span><span class="Apple-style-span" style="font-family: Menlo; font-size: 11px;">:completionHandler];</span></div>
<div>
<span class="Apple-style-span" style="font-family: Menlo; font-size: 11px;"><br /></span></div>
<div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Menlo; font-size: 11px;"><span class="Apple-style-span" style="font-family: Times; font-size: small;">and you can see the last post to see how to use it completely with the sample code.<u> <a href="http://soulwithmobiletechnology.blogspot.com/2012/07/tutorial-how-to-use-inbuilt.html">LINK</a>.</u></span></span></div>
</div>
<br />
<br />
<div>
<br /></div>
</div><div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>Reetu Rajhttp://www.blogger.com/profile/08458984428135077241noreply@blogger.com2tag:blogger.com,1999:blog-4602316338438806651.post-17159222961045175902012-07-16T17:24:00.003-07:002012-07-16T17:27:38.745-07:00Tutorial: How to use inbuilt Facebook/Twitter API in iOS6.<div dir="ltr" style="text-align: left;" trbidi="on">
You need to add Social.framework in your project.<br />
Add to your file following <span class="Apple-style-span" style="color: #e30009; font-family: Menlo; font-size: 11px;"><span style="color: #7f4627;">#import "</span>Social/Social.h"</span><br />
<span class="Apple-style-span" style="color: #e30009; font-family: Menlo;"><span class="Apple-style-span" style="font-size: 11px;"><br /></span></span><br />
<span class="Apple-style-span" style="color: #e30009; font-family: Menlo; font-size: 11px;"><span class="Apple-style-span" style="color: black; font-family: Times; font-size: small;">You can create 3 type of service:</span></span><br />
<span class="Apple-style-span" style="color: #e30009; font-family: Menlo; font-size: 11px;"><span class="Apple-style-span" style="color: black; font-family: Times; font-size: small;"><br /></span></span><br />
<span class="Apple-style-span" style="color: #e30009; font-family: Menlo; font-size: 11px;"><span class="Apple-style-span" style="color: black; font-family: Times; font-size: small;"></span></span><br />
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
SLServiceTypeTwitter;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
SLServiceTypeFacebook;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
SLServiceTypeSinaWeibo;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
I have created service of Facebook.<br />
<br />
<br />
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
SLComposeViewController<span style="color: black;"> *fbController=[</span>SLComposeViewController<span style="color: black;"> </span><span style="color: #490084;">composeViewControllerForServiceType</span><span style="color: black;">:</span>SLServiceTypeFacebook<span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<br /></div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #ce00a4;">if</span><span style="color: black;">([</span>SLComposeViewController<span style="color: black;"> </span><span style="color: #490084;">isAvailableForServiceType</span><span style="color: black;">:</span>SLServiceTypeFacebook<span style="color: black;">])</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
{</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
SLComposeViewControllerCompletionHandler <span style="color: #ce00a4;">__block</span> completionHandler=^(<span style="color: #7e1bad;">SLComposeViewControllerResult</span> result){</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="color: #490084; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> [fbController </span>dismissViewControllerAnimated<span style="color: black;">:</span><span style="color: #ce00a4;">YES</span><span style="color: black;"> </span>completion<span style="color: black;">:</span><span style="color: #ce00a4;">nil</span><span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #ce00a4;">switch</span>(result){</div>
<div style="color: #490084; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> </span><span style="color: #ce00a4;">case</span><span style="color: black;"> </span>SLComposeViewControllerResultCancelled<span style="color: black;">:</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #ce00a4;">default</span>:</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
{</div>
<div style="color: #e30009; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> </span><span style="color: #490084;">NSLog</span><span style="color: black;">(</span>@"Cancelled....."<span style="color: black;">);</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
}</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #ce00a4;">break</span>;</div>
<div style="color: #490084; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> </span><span style="color: #ce00a4;">case</span><span style="color: black;"> </span>SLComposeViewControllerResultDone<span style="color: black;">:</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
{</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #490084;">NSLog</span>(<span style="color: #e30009;">@"Posted...."</span>);</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
}</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #ce00a4;">break</span>;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
}};</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[fbController <span style="color: #490084;">addImage</span>:[<span style="color: #7e1bad;">UIImage</span> <span style="color: #490084;">imageNamed</span>:<span style="color: #e30009;">@"1.jpg"</span>]];</div>
<div style="color: #e30009; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> [fbController </span><span style="color: #490084;">setInitialText</span><span style="color: black;">:</span>@"Check out this article."<span style="color: black;">];</span></div>
<div style="color: #e30009; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> [fbController </span><span style="color: #490084;">addURL</span><span style="color: black;">:[</span><span style="color: #7e1bad;">NSURL</span><span style="color: black;"> </span><span style="color: #490084;">URLWithString</span><span style="color: black;">:</span>@"http://soulwithmobiletechnology.blogspot.com/"<span style="color: black;">]];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[fbController <span style="color: #490084;">setCompletionHandler</span>:completionHandler];</div>
<div style="color: #490084; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> [</span><span style="color: #ce00a4;">self</span><span style="color: black;"> </span>presentViewController<span style="color: black;">:fbController </span>animated<span style="color: black;">:</span><span style="color: #ce00a4;">YES</span><span style="color: black;"> </span>completion<span style="color: black;">:</span><span style="color: #ce00a4;">nil</span><span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
}</div>
<div>
<br /></div>
<br />
<br />
I have added image which will be posted with the message and URL on the Facebook page. Here is what the message looks like on FB.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-TA3aBdaaK-o/UASvoejND2I/AAAAAAAADlo/PP3_Piz4gkI/s1600/Message+Posted+on+FB.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="400" src="http://4.bp.blogspot.com/-TA3aBdaaK-o/UASvoejND2I/AAAAAAAADlo/PP3_Piz4gkI/s400/Message+Posted+on+FB.png" width="355" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
Following are some screenshots of the app running.<br />
<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpGN21qNbTKHoORroRP-GaU2aoOseO2RJrN78RLnK2Xuiq7KP4JbCims9HPsdaZLJSfOjhYtO_N43S0RoXiNVO4aI3uimJecJiWr_JYTdeC5HowgIWAym9RrDarq0oddLwJfrbGiroow/s1600/Facebook+iOS+6+_+1.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="207" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpGN21qNbTKHoORroRP-GaU2aoOseO2RJrN78RLnK2Xuiq7KP4JbCims9HPsdaZLJSfOjhYtO_N43S0RoXiNVO4aI3uimJecJiWr_JYTdeC5HowgIWAym9RrDarq0oddLwJfrbGiroow/s320/Facebook+iOS+6+_+1.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">If the Facebook account is not set up on device, it gives you this pop up.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFDy0CxRzM9GvCAlRet4HtBUrsT5mSnlxLPn6HUrL7NTiMjjEZnY1HwyvxBqdw9DwSij6rIOxKYtlbkvBO8H2aht3vz8FrOCvnOghaoEqFt8F8lwh1h_GpzOgD_JUj87RmUCYV5mMvAA/s1600/Facebook+iOS+6+_+2.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="162" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFDy0CxRzM9GvCAlRet4HtBUrsT5mSnlxLPn6HUrL7NTiMjjEZnY1HwyvxBqdw9DwSij6rIOxKYtlbkvBO8H2aht3vz8FrOCvnOghaoEqFt8F8lwh1h_GpzOgD_JUj87RmUCYV5mMvAA/s320/Facebook+iOS+6+_+2.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">SLComposeViewController with added URL and Image.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-gSaAKVvyQtM/UASvnIITW1I/AAAAAAAADlQ/N-3yXGPOBWw/s1600/Facebook+iOS+6+_+3.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="150" src="http://1.bp.blogspot.com/-gSaAKVvyQtM/UASvnIITW1I/AAAAAAAADlQ/N-3yXGPOBWw/s320/Facebook+iOS+6+_+3.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">SLComposeViewController with added text,URL and image, <br />
Also location has been set on the post <br />
just like we can do on our Facebook page.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-IEk3g26j12I/UASvnWrzjkI/AAAAAAAADlY/8AdGF6vzXGA/s1600/Facebook+iOS+6+_+4.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="238" src="http://1.bp.blogspot.com/-IEk3g26j12I/UASvnWrzjkI/AAAAAAAADlY/8AdGF6vzXGA/s320/Facebook+iOS+6+_+4.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">You can change the album in which you want to post this image.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-d2FJCxOYXTc/UASvnxZewjI/AAAAAAAADlg/E4KxcMrIdxI/s1600/Facebook+iOS+6+_+5.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="204" src="http://4.bp.blogspot.com/-d2FJCxOYXTc/UASvnxZewjI/AAAAAAAADlg/E4KxcMrIdxI/s320/Facebook+iOS+6+_+5.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">You can choose which group you want to display this post to.</td></tr>
</tbody></table>
<br />
<br />
<br />
<br />
<br />
<u><a href="http://dl.dropbox.com/u/1396078/SocialFrameworkTest.zip">Link to download the sample code.</a></u></div><div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>Reetu Rajhttp://www.blogger.com/profile/08458984428135077241noreply@blogger.com13tag:blogger.com,1999:blog-4602316338438806651.post-14622595904953229272012-07-12T09:34:00.002-07:002012-07-12T09:37:16.170-07:00Mac OS Evolution<div dir="ltr" style="text-align: left;" trbidi="on">
1978 <b><span style="color: #444444;">Apple</span></b> introduces Apple DOS 3.1, the first operating system for the Apple computers in June. <br />
<br />
1984 <b><span style="color: #444444;">Apple</span></b> introduces System 1. <br />
<br />
1985 <b><span style="color: #444444;">Apple</span></b> introduces System 2. <br />
<br />
1986 <b><span style="color: #444444;">Apple</span></b> introduces System 3. <br />
<br />
1987 <b><span style="color: #444444;">Apple</span></b> introduces System 4. <br />
<br />
1988 <b><span style="color: #444444;">Apple</span></b> introduces System 6. <br />
<br />
1991 <b><span style="color: #444444;">Apple</span></b> introduces System 7 operating system May 13, 1991. <br />
<br />
1995 <b><span style="color: #444444;">Apple</span></b> allows other computer companies to clone its computer by announcing its licensed the Macintosh operating system rights to Radius on January 4. <br />
<br />
1997 <b><span style="color: #444444;">Apple</span></b> introduces Mac OS 8. 1997Apple buys NeXT Software Inc. for $400 million and acquires Steve Jobs, Apples cofounder, as a consultant. <br />
<br />
1999 <b><span style="color: #444444;">Apple</span></b> introduces Mac OS 9. <br />
<br />
2001 <b><span style="color: #444444;">Apple</span></b> introduces Mac OS X 10.0 named <b>Cheetah</b> and becomes available March 24, 2001. <br />
<br />
2001 <b><span style="color: #444444;">Apple</span></b> introduces Mac OS X 10.1 named <b>Puma</b> and becomes available on September 25, 2001. <br />
<br />
2002 <b><span style="color: #444444;">Apple</span></b> introduces Mac OS X 10.2 named <b>Jaguar</b> and becomes available on August 23, 2002. <br />
<br />
2003 <b><span style="color: #444444;">Apple</span></b> introduces Mac OS X 10.3 named <b>Panther</b> October 25, 2003. <br />
<br />
2004 <b><span style="color: #444444;">Apple</span></b> introduces Mac OS X 10.4 named <b>Tiger</b> at the WWDC on June 28, 2004. <br />
<br />
2007 <b><span style="color: #444444;">Apple</span></b> introduces Mac OS X 10.5 named <b>Leopard</b> October 26, 2007. <br />
<br />
2008 <b><span style="color: #444444;">Apple</span></b> introduces Mac OS X 10.6 named <b>Snow Leopard</b> and <b>MobileMe</b> at the WWDC on June 9, 2008.<br />
<br />
2011 <b><span style="color: #444444;">Apple</span></b> introduces Mac OS X 10.7 named <b>Lion</b> was released on July 20, 2011.<br />
<br />
2012 <b><span style="color: #444444;">Apple</span></b> introduces Mac OS X 10.8 named <b>Mountain Lion</b> will be released in July 2012.</div><div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>Reetu Rajhttp://www.blogger.com/profile/08458984428135077241noreply@blogger.com1tag:blogger.com,1999:blog-4602316338438806651.post-4931881817419869632012-07-10T21:14:00.005-07:002012-07-10T21:15:43.114-07:00Features in new Mountain Lion OS.<div dir="ltr" style="text-align: left;" trbidi="on">
Atmosphere is again hot with the anticipation of new Mac OS. Again, millions of 20 dollars will be added to trillion dollar Apple :) Lets take a quick look at the feature list.<br />
<br />
<div style="text-align: left;">
</div>
<ul style="text-align: left;">
<li> iCloud is automatic and effortless now. Just sign in once with your Apple ID and iCloud is set up in all the apps that use it.</li>
</ul>
<div>
<br /></div>
<ul style="text-align: left;">
<li>Reminder: Set due dates and you’ll get alerts as deadlines approach. Set a
location from your Mac, and your iPhone or iPad will remind you when you
get there.</li>
</ul>
<div>
<br /></div>
<ul style="text-align: left;">
<li>Notes: Its more noteworthy with photos, images, and attachments.Pin important notes to your desktop so they’re easy to get to. </li>
</ul>
<div>
<br /></div>
<ul style="text-align: left;">
<li>iMessage: You can send messages to anyone on an iPhone, iPad, or iPod touch
running iOS 5, too.Send photos, videos, documents, and contacts — even send messages to a group. </li>
</ul>
<div>
<br /></div>
<ul style="text-align: left;">
<li> Notification Center just like iPad—for any new email, a message, a software update or a calendar alert.</li>
</ul>
<div>
<br /></div>
<ul style="text-align: left;">
<li>Power Nap is most awesome-It periodically updates Mail, Contacts, Calendar, Reminders, Notes,
Photo Stream, Find My Mac, and Documents in the Cloud,downloads software updates and makes
backups with Time Machine. While updating, the
system sounds are silent and no lights or fans come on, so nothing
disturbs you as reported on Apple's website.</li>
</ul>
<div>
<br /></div>
<ul style="text-align: left;">
<li>Dictation -It converts your words into text.And it recognizes people from your contacts so it enters names accurately. Dictation supports English (U.S., UK, and Australia), French, German, and Japanese.</li>
</ul>
<div>
<br /></div>
<ul style="text-align: left;">
<li>Share Button-There is Share button throughout OS X Mountain Lion.</li>
</ul>
<div>
<br /></div>
<ul style="text-align: left;">
<li>Built-in Facebook support- You can share what’s up with you right
from the app you’re in. Post photos or links. Add comments and
locations.OS X adds your Facebook friends and their profile photos to Contacts.</li>
</ul>
<div>
<br /></div>
<ul style="text-align: left;">
<li>Built-in Twitter support- OS X Mountain Lion is designed for tweeting. Sign in once and you’re all set up .You can tweet from Notification Center, too.</li>
</ul>
<div>
<br /></div>
<ul style="text-align: left;">
<li>Game Center app - You can play anyone on a Mac, iPad, iPhone, and iPod touch.Just use your Game Center account from iOS or create one with your Apple ID. Then sign in and you’re in.</li>
</ul>
<div>
<br /></div>
<ul style="text-align: left;">
<li>Gatekeeper -It helps protect you from downloading and installing malicious software on your Mac.</li>
</ul>
<div>
<br /></div>
<ul style="text-align: left;">
<li>Safari- When you open web pages on your iPhone or iPad, iCloud Tabs makes them available on your Mac, too. So you can pick up browsing wherever you left off. Safari saves entire web pages in your Reading List,not just the links. </li>
</ul>
<div>
<br /></div>
<ul style="text-align: left;">
<li>To read full list of 200+ features, <a href="http://www.apple.com/osx/whats-new/features.html">HERE is the link.</a></li>
</ul>
</div><div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>Reetu Rajhttp://www.blogger.com/profile/08458984428135077241noreply@blogger.com0tag:blogger.com,1999:blog-4602316338438806651.post-70573264084678881112012-07-10T18:42:00.003-07:002012-07-10T18:42:31.925-07:00Running on iPhone or iPad ?<div dir="ltr" style="text-align: left;" trbidi="on">
Developing a universal app makes it a necessity to find out if the app is running on iPhone or iPad, accordingly you write your code block.<br />
Here is the code:<br />
<br />
<br />
<div style="color: #7f4627; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #ce00a4;">if</span><span style="color: black;"> (</span>UI_USER_INTERFACE_IDIOM<span style="color: black;">() == </span><span style="color: #490084;">UIUserInterfaceIdiomPad</span><span style="color: black;">)</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
{</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
}</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #ce00a4;">if</span> (<span style="color: #7f4627;">UI_USER_INTERFACE_IDIOM</span>() == <span style="color: #490084;">UIUserInterfaceIdiomPhone</span>)</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
{</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
}</div>
</div><div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>Reetu Rajhttp://www.blogger.com/profile/08458984428135077241noreply@blogger.com0tag:blogger.com,1999:blog-4602316338438806651.post-60332628386373212192012-07-10T18:35:00.002-07:002012-07-10T18:36:19.778-07:00How to find OS version of iOS device.<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="color: #490084; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">NSString</span><span style="color: black;"> *currentOS = [[</span><span style="color: #7e1bad;">UIDevice</span><span style="color: black;"> </span>currentDevice<span style="color: black;">] </span>systemVersion<span style="color: black;">];</span></div>
<div style="color: #490084; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"><br /></span></div>
<div style="color: #490084; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"><br /></span></div>
<div style="font: normal normal normal 11px/normal Menlo; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
How to check if current OS is minimum version you need. Suppose minimum you need is 4.2<br />
<br />
<div style="color: #490084; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">NSString</span><span style="color: black;"> *currentOS = [[</span><span style="color: #7e1bad;">UIDevice</span><span style="color: black;"> </span>currentDevice<span style="color: black;">] </span>systemVersion<span style="color: black;">];</span></div>
<div style="color: #490084; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #ce00a4;">if</span><span style="color: black;"> ([currentOS </span>compare<span style="color: black;">:</span><span style="color: #e30009;">@"4.2"</span><span style="color: black;"> </span>options<span style="color: black;">:</span>NSNumericSearch<span style="color: black;">] != </span>NSOrderedAscending<span style="color: black;">)</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
{</div>
<div style="font: normal normal normal 11px/normal Menlo; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span style="color: #490084;">NSLog</span><span style="color: black;">(</span><span class="Apple-style-span" style="color: #e30009;">@"Yes, it is greater than or equal to 4.2"</span><span style="color: black;">);</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
}<br />
<br />
<br />
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
</div><div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>Reetu Rajhttp://www.blogger.com/profile/08458984428135077241noreply@blogger.com0tag:blogger.com,1999:blog-4602316338438806651.post-86888161273407428882012-07-02T08:02:00.005-07:002012-07-02T08:03:27.760-07:00How to add Event in device Calender.<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
EKEventStore<span style="color: black;"> *eventStore = [[</span>EKEventStore<span style="color: black;"> </span><span style="color: #490084;">alloc</span><span style="color: black;">] </span><span style="color: #490084;">init</span><span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">EKEvent</span> *event = [<span style="color: #7e1bad;">EKEvent</span> <span style="color: #490084;">eventWithEventStore</span>:eventStore];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
event.<span style="color: #7e1bad;">title</span> = <span class="Apple-style-span" style="color: #e30009;">@"My Event Name"</span>;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span class="Apple-style-span"> event.<span style="color: #7e1bad;">startDate</span> =[</span><span class="Apple-style-span" style="color: #7e1bad;">NSDate</span><span class="Apple-style-span"> <span style="color: #490084;">date</span>];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
event.<span style="color: #7e1bad;">endDate</span> = [[<span style="color: #7e1bad;">NSDate</span> <span style="color: #490084;">alloc</span>] <span style="color: #490084;">initWithTimeInterval</span>:<span style="color: #4600dd;">60</span> <span style="color: #490084;">sinceDate</span>:event.<span style="color: #7e1bad;">startDate</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="color: #490084; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> [event </span>setCalendar<span style="color: black;">:[eventStore </span>defaultCalendarForNewEvents<span style="color: black;">]];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">NSError</span> *err;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[eventStore <span style="color: #490084;">saveEvent</span>:event <span style="color: #490084;">span</span>:<span style="color: #490084;">EKSpanThisEvent</span> <span style="color: #490084;">error</span>:&err]; </div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
And don't forget to add <span class="Apple-style-span" style="color: #e30009; font-family: Menlo; font-size: 11px;"><span style="color: #7f4627;">#import </span><eventkit eventkit.h=""> </eventkit></span>to your file and EventKit framework to your project.</div><div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>Reetu Rajhttp://www.blogger.com/profile/08458984428135077241noreply@blogger.com0tag:blogger.com,1999:blog-4602316338438806651.post-6603319784387828712012-06-28T20:58:00.002-07:002012-06-28T21:01:26.938-07:00Save NSDate in CoreData<div dir="ltr" style="text-align: left;" trbidi="on">
1. In your model file.<br />
Create an entity MyDate with attribute datestring of datatype date(select it from dropdown).<br />
<br />
<br />
2. Save your date<br />
<br />
<br />
<div style="color: #008c00; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> </span>//Create date from the string</div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> </span>NSDateFormatter<span style="color: black;"> *dateFormatter = [[</span>NSDateFormatter<span style="color: black;"> </span><span style="color: #490084;">alloc</span><span style="color: black;">] </span><span style="color: #490084;">init</span><span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[dateFormatter <span style="color: #490084;">setDateFormat</span>:<span style="color: #e30009;">@"dd-MM-yyyy"</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">NSDate</span> *date=[dateFormatter <span style="color: #490084;">dateFromString</span>:<span style="color: #3e8388;">dateString_</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[dateFormatter <span style="color: #490084;">release</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
dateFormatter=<span style="color: #ce00a4;">nil</span>;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="color: #008c00; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> </span>//Save the auditDate Now<span class="Apple-style-span" style="color: black;"> </span></div>
<div style="color: #490084; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> </span><span style="color: #3e8388;">MyDate</span><span style="color: black;"> *obj = [</span><span style="color: #7e1bad;">NSEntityDescription</span><span style="color: black;"> </span>insertNewObjectForEntityForName<span style="color: black;">:</span><span style="color: #e30009;">@"MyDate"</span><span style="color: black;"> </span>inManagedObjectContext<span style="color: black;">:context];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span class="Apple-style-span"> [</span>obj<span class="Apple-style-span"> <span style="color: #490084;">setValue</span>:date <span style="color: #490084;">forKey</span>:<span style="color: #e30009;">@"datestring"</span>];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">NSError</span>* error = <span style="color: #ce00a4;">nil</span>;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[context <span style="color: #490084;">save</span>:&error];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #ce00a4;">if</span> (error)</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
{</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #490084;">NSLog</span>(<span style="color: #e30009;">@"%@"</span>, error);</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
}<br />
<br />
<br />
<br />
<br />
<span class="Apple-style-span" style="font-family: Times; font-size: small;">3. Retrieve your date</span><br />
<div style="font-family: Times; font-size: medium; font: normal normal normal 11px/normal Menlo; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: left;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: Times; font-size: small;"><br /></span></div>
</div>
<div style="font-family: Times; font-size: medium; font: normal normal normal 11px/normal Menlo; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: left;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: Times; font-size: small;">When you retrieve </span><span class="Apple-style-span" style="color: #3e8388;">MyDate </span><span class="Apple-style-span" style="font-family: Times; font-size: small;">objects, accessing value of key </span><span class="Apple-style-span" style="color: #e30009;">datestring </span><span class="Apple-style-span" style="font-family: Times; font-size: small;">will return NSDate, you can convert that to NSString to display it on your screen.</span><br />
<span class="Apple-style-span" style="font-family: Times; font-size: small;"><br /></span><br />
<span class="Apple-style-span" style="font-family: Times; font-size: small;"><br /></span><br />
<span class="Apple-style-span" style="font-family: Times; font-size: small;"><br /></span></div>
</div>
</div>
</div><div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>Reetu Rajhttp://www.blogger.com/profile/08458984428135077241noreply@blogger.com0tag:blogger.com,1999:blog-4602316338438806651.post-6033198497668011832012-06-28T08:09:00.000-07:002012-06-28T21:00:05.683-07:00Get number of days in a month<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="color: #7e1bad; font-family: Menlo; font-size: 11px;">NSDate<span style="color: black;"> *today=[</span>NSDate<span style="color: black;"> </span><span style="color: #490084;">date</span><span style="color: black;">];</span></span><br />
<span class="Apple-style-span" style="color: #7e1bad; font-family: Menlo; font-size: 11px;"><br /></span><br />
<span class="Apple-style-span" style="color: #7e1bad; font-family: Menlo; font-size: 11px;">NSCalendar<span style="color: black;"> *gregorian = [[</span>NSCalendar<span style="color: black;"> </span><span style="color: #490084;">alloc</span><span style="color: black;">] </span><span style="color: #490084;">initWithCalendarIdentifier</span><span style="color: black;">:</span>NSGregorianCalendar<span style="color: black;">];</span></span><br />
<div style="color: #490084; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">NSRange</span><span style="color: black;"> days = [gregorian </span>rangeOfUnit<span style="color: black;">:</span>NSDayCalendarUnit<span style="color: black;"> </span>inUnit<span style="color: black;">:</span>NSMonthCalendarUnit<span style="color: black;"> </span>forDate<span style="color: black;">:date];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
<span style="color: #ce00a4;">int</span> daysInGivenMonth= days.<span style="color: #7e1bad;">length</span>;<br />
<br />
<br />
<br />
<br />
<br />
<br /></div>
</div><div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>D.Scotthttp://www.blogger.com/profile/12479588119455093007noreply@blogger.com0tag:blogger.com,1999:blog-4602316338438806651.post-81056945100677423042012-06-28T08:02:00.001-07:002012-06-28T08:09:39.771-07:00Get first day of a month.First we will build first date (01-xx-xxxx)of a given month.<br />
Of course you can change 01 to anything like 12,26 or whatever date you want to find day of.<br />
<br />
<br />
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #ce00a4;">int </span>month = <span class="Apple-style-span" style="color: #4600dd;">4</span>;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #ce00a4;">int </span>year=<span class="Apple-style-span" style="color: #4600dd;">2012</span>;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<br /></div>
<br />
<br />
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
NSDateFormatter<span style="color: black;"> *dateFormatter = [[</span>NSDateFormatter<span style="color: black;"> </span><span style="color: #490084;">alloc</span><span style="color: black;">] </span><span style="color: #490084;">init</span><span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[dateFormatter <span style="color: #490084;">setDateFormat</span>:<span style="color: #e30009;">@"dd-MM-yyyy"</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">NSDate</span> *date=[dateFormatter <span style="color: #490084;">dateFromString</span>:[<span style="color: #7e1bad;">NSString</span> <span style="color: #490084;">stringWithFormat</span>:<span style="color: #e30009;">@"01-%i</span><span style="color: #e30009;">-</span><span class="Apple-style-span" style="font-family: Menlo; font-size: 11px;"><span style="color: #e30009;">%i"</span></span><span class="Apple-style-span" style="font-family: Menlo; font-size: 11px;"><span class="Apple-style-span" style="font-family: Menlo; font-size: 11px;">,month,year]];</span></span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[dateFormatter <span style="color: #490084;">release</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
dateFormatter=<span style="color: #ce00a4;">nil</span>;</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span class="Apple-style-span" style="font-family: Times; font-size: small;"><br /></span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span class="Apple-style-span" style="font-family: Times; font-size: small;">Then </span><span class="Apple-style-span" style="font-family: Times; font-size: small;">we will find day for the above date in Gregorian Calendar. You can choose the method give in previous article where you create </span><span class="Apple-style-span" style="color: #7e1bad;">NSDateFormatter</span><span class="Apple-style-span" style="font-family: Times; font-size: small;"> with </span><span class="Apple-style-span" style="color: #e30009;">@"EEEE"</span><span class="Apple-style-span" style="font-family: Times; font-size: small;">,But if you are calendar specific, then following is the way.</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span class="Apple-style-span" style="font-family: Times; font-size: small;"><br /></span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span class="Apple-style-span" style="font-family: Times; font-size: small;"></span></div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
NSCalendar<span style="color: black;"> *gregorian = [[</span>NSCalendar<span style="color: black;"> </span><span style="color: #490084;">alloc</span><span style="color: black;">] </span><span style="color: #490084;">initWithCalendarIdentifier</span><span style="color: black;">:</span>NSGregorianCalendar<span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">NSDateComponents</span> *weekdayComponents =[gregorian <span style="color: #490084;">components</span>:<span style="color: #490084;">NSWeekdayCalendarUnit</span> <span style="color: #490084;">fromDate</span>:date];</div>
<div style="color: #008c00; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span class="Apple-style-span" style="color: #ce00a4;">int </span><span style="color: black;">firstDay = [weekdayComponents </span><span style="color: #490084;">weekday</span><span style="color: black;">];</span>//1 for Sun,2 for Mon etc</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[gregorian <span style="color: #490084;">release</span>];</div>
<br /><div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>D.Scotthttp://www.blogger.com/profile/12479588119455093007noreply@blogger.com0tag:blogger.com,1999:blog-4602316338438806651.post-87635961569709909732012-06-28T07:54:00.001-07:002012-06-28T07:54:43.769-07:00Get Day Name in NSDateIn this example we will find what day(Sun, Mon or Tue etc) is it for a given date.<br />
<br />
<br />
<br />
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;"> NSDate</span> *today=[<span style="color: #7e1bad;">NSDate</span> <span style="color: #490084;">date</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> </span>NSDateFormatter<span style="color: black;"> *dateFormatter = [[</span>NSDateFormatter<span style="color: black;"> </span><span style="color: #490084;">alloc</span><span style="color: black;">] </span><span style="color: #490084;">init</span><span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[dateFormatter <span style="color: #490084;">setDateFormat</span>:<span style="color: #e30009;">@"EEEE"</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">NSString</span> *currentDay = [dateFormatter <span style="color: #490084;">stringFromDate</span>:today];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
</div>
<div style="color: #e30009; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #490084;"> NSLog</span><span style="color: black;">(</span>@"currentDay=%@"<span style="color: black;">,</span><span class="Apple-style-span" style="color: black;"> currentDay</span><span style="color: black;">);</span></div>
<div style="color: #e30009; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"></span></div>
<div style="color: #008c00; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
//currentDay is 1 for Sun, 2 for Mon</div>
<br />
<br />
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[dateFormatter <span style="color: #490084;">release</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
</div><div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>D.Scotthttp://www.blogger.com/profile/12479588119455093007noreply@blogger.com0tag:blogger.com,1999:blog-4602316338438806651.post-40944553718280944552012-06-28T07:51:00.002-07:002012-06-28T07:51:46.950-07:00Get Month from NSDateIn this example we will take todays date and find the month in todays date.<br />
<br />
<br />
<br />
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;"> NSDate</span> *today=[<span style="color: #7e1bad;">NSDate</span> <span style="color: #490084;">date</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;">
</div>
<div style="color: #7e1bad; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: black;"> </span>NSDateFormatter<span style="color: black;"> *dateFormatter = [[</span>NSDateFormatter<span style="color: black;"> </span><span style="color: #490084;">alloc</span><span style="color: black;">] </span><span style="color: #490084;">init</span><span style="color: black;">];</span></div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[dateFormatter <span style="color: #490084;">setDateFormat</span>:<span style="color: #e30009;">@"M"</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #7e1bad;">NSString</span> *currentMonth = [dateFormatter <span style="color: #490084;">stringFromDate</span>:today];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
</div>
<div style="color: #008c00; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
//currentMonth will be 1 for Jan, 2 for Feb etc</div>
<div style="color: #008c00; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
</div>
<div style="color: #e30009; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
<span style="color: #490084;"> NSLog</span><span style="color: black;">(</span>@"currentMonth=%@"<span style="color: black;">,currentMonth);</span></div>
<br />
<br />
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
[dateFormatter <span style="color: #490084;">release</span>];</div>
<div style="font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;">
</div><div class="blogger-post-footer">--
Best Happens with Us in Mobile!
Nighsoft
(www.nighsoft.com)</div>D.Scotthttp://www.blogger.com/profile/12479588119455093007noreply@blogger.com0