Skip to main content

Posts

Showing posts with the label Mobile Development Tutorials

Reference from UITableViewCell to parent UITableView?

Store a weak reference to the tableView in the cell, which you'd set in -tableView:cellForRowAtIndexPath: of your table's dataSource. This is better than relying on self.superview to always be exactly the tableView is fragile. Who knows how Apple might re-organize the view hierarchy of UITableView in the future.
I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.

This article is related to

iPad,iPhone,iPhone Resources,iPhone Artic…

How to prioritize gesture recognizers and touches in a UIView

It sounds like you need: swipeUpTwoFinger.delaysTouchesBegan = YES; 
I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too. 
Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.

This article is related to
iPad,iPhone,iPhone Resources,iPhone Articles,iPhone Development,iPhone Turorial,Mobile Development Tutorials,Mobile Developments,Objective C
​,Swift, UIView

Swift : How to Rotate a UIImage 90 degrees?

In Swift and Objective-C, the easiest way (and thread safe too) is to do:
//assume that the image is loaded in landscape mode from disk UIImage * LandscapeImage = [UIImage imageNamed: imgname]; UIImage * PortraitImage = [[UIImage alloc] initWithCGImage: LandscapeImage.CGImage scale: 1.0 orientation: UIImageOrientationRight];
This only modifies the orientation data of the image - the pixel data is untouched. For some applications, this may not be enough.
Or in swift:
let PortraitImage  : UIImage = UIImage(CGImage: LandscapeImage.CGImage , scale: 1.0 , orientation: UIImageOrientation.Right)
I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too. 
Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe t…

Swift : How to calculate a person's age from their birth date in NSDate format

In Swift, here is a class method extension to NSDate that calculates a person's age given their birthday in NSDate format:
extension NSDate {    class func calculateAge(birthDate: NSDate) -> Int {        var calendar = NSCalendar.currentCalendar()        let ageComponents = calendar.components(.CalendarUnitYear, fromDate: birthDate, toDate: NSDate(), options: nil)       return ageComponents.year    } }
You use it like this:
let age = NSDate.calculateAge(<pass the NSDate>)
I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your regis…

How to filter NSArray in Swift?

Here is what you can do
Swift version:
let resultPredicate = NSPredicate(format: "name contains[c] %@", searchText) self.filteredUserData = self.userData.filteredArrayUsingPredicate(resultPredicate)
Objective-C version:
NSPredicate *sPredicate = [NSPredicate predicateWithFormat:@"SELF contains[c] 's'"]; [array filterUsingPredicate:sPredicate];
I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too. 
Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.

This article is re…

How to convert a decimal number to binary in Swift?

You can convert the decimal value to a human-readable binary representation using the String initializer that takes a radix parameter:
let num = 22 let str = String(num, radix: 2) println(str) // prints "10110"
If you wanted to, you could also pad it with any number of zeroes pretty easily as well:
func pad(string : String, toSize: Int) -> String {     var padded = string     for i in 0..<toSize - countElements(string) {         padded = "0" + padded     }     return padded }
let num = 22 let str = String(num, radix: 2) println(str) // 10110 pad(str, 8)  // 00010110
I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our N…

Swift - Integer conversion to Hours/Minutes/Seconds

Define
func secondsToHoursMinutesSeconds (seconds : Int) -> (Int, Int, Int) {   return (seconds / 3600, (seconds % 3600) / 60, (seconds % 3600) % 60) } Use
> secondsToHoursMinutesSeconds(27005) (7,30,5) or
let (h,m,s) = secondsToHoursMinutesSeconds(27005)
The above function makes use of Swift tuples to return three values at once. You destructure the tuple using the let (var, ...) syntax or can access individual tuple members, if need be.
If you actually need to print it out with the words Hours etc then use something like this:
func printSecondsToHoursMinutesSeconds (seconds:Int) -> () {   let (h, m, s) = secondsToHoursMinutesSeconds (seconds)   println ("\(h) Hours, \(m) Minutes, \(s) Seconds") }
Note that the above implementation of secondsToHoursMinutesSeconds() works for Int arguments. If you want a Double version you'll need to decide what the return values are - could be (Int, Int, Double) or could be (Double, Double, Double). You could try something like:
func secondsTo…

Convert Int to String in Swift

Converting Int to String:
let x : Int = 42 var myString = String(x) And the other way around - converting String to Int:
let myString : String = "42" let x: Int? = myString.toInt()
if (x != nil) {     // Successfully converted String to Int }
Or if you're using Swift 2:
let x: Int? = Int(myString)
I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.

This article is related to


​Swift,​ iPad,iPhone,iPhone Resources,iPhone Articles,iPhone D…

Does Swift support implicit conversion?

There is no implicitly cast in Swift.
Easy way of conversion in swift is using constructor of particular type.
Like if you want to get Float from double then you can use Float(doubleValue) and Same way if you want to convert float to integer then you can use Int(floatValue).
Like:
let intValue = UInt8(doubleValue)
Beware that you will loose number after decimal point. So, choose a better way. Above conversion is just to help you in understanding.
Note that Swift always chooses Double (rather than Float) when inferring the type of floating-point numbers.
I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID t…

Swift - How to convert String to Double

You can simply bridge it like this:
(swiftString as NSString).doubleValue
I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.

This article is related to

​Swift,​ iPad,iPhone,iPhone Resources,iPhone Articles,iPhone Development,iPhone Game Development,iPhone Turorial,Mobile Development Tutorials,Mobile Developments

Convert Float to Int in Swift

You can convert Float to Int in Swift language such like,
var myIntValue:Int = Int(myFloatValue) println "My value is \(myIntValue)"
I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.

This article is related to

​Swift,​ iPad,iPhone,iPhone Resources,iPhone Articles,iPhone Development,iPhone Game Development,iPhone Turorial,Mobile Development Tutorials,Mobile Developments

What is the difference between -viewWillAppear: and -viewDidAppear:?

In general, this is what I do:
1) ViewDidLoad - Whenever I'm adding controls to a view that should appear together with the view, right away, I put it in the ViewDidLoad method. Basically this method is called whenever the view was loaded into memory. So for example, if my view is a form with 3 labels, I would add the labels here; the view will never exist without those forms.
2) ViewWillAppear: I use ViewWillAppear usually just to update the data on the form. So, for the example above, I would use this to actually load the data from my domain into the form. Creation of UIViews is fairly expensive, and you should avoid as much as possible doing that on the ViewWillAppear method, becuase when this gets called, it means that the iPhone is already ready to show the UIView to the user, and anything heavy you do here will impact performance in a very visible manner (like animations being delayed, etc).
3) ViewDidAppear: Finally, I use the ViewDidAppear to start off new threads to things t…

Looking to understand the iOS UIViewController lifecycle

All these commands are called automatically at the appropriate times by iOS when you load/present/hide the view controller. It's important to note that these methods are attached to UIViewController and not to UIViews themselves. You won't get any of these features just using a UIView.
There's great documentation on Apple's site here. Putting in simply though: ViewDidLoad - Called when you create the class and load from xib. Great for initial setup and one-time-only work.ViewWillAppear - Called right before your view appears, good for hiding/showing fields or any operations that you want to happen every time before the view is visible. Because you might be going back and forth between views, this will be called every time your view is about to appear on the screen.ViewDidAppear - Called after the view appears - great place to start an animations or the loading of external data from an API.ViewWill/DidDisappear - Same idea as WillAppear.ViewDidUnload/ViewDidDispos…

How to set iPhone UI View z index?

UIView siblings are stacked in the order in which they are added to their superview. The UIView hierarchy methods and properties are there to manage view order. In UIView.h:
@property(nonatomic,readonly) UIView *superview; @property(nonatomic,readonly,copy) NSArray *subviews;
- (void)removeFromSuperview; - (void)insertSubview:(UIView *)view atIndex:(NSInteger)index; - (void)exchangeSubviewAtIndex:(NSInteger)index1 withSubviewAtIndex:(NSInteger)index2;
- (void)addSubview:(UIView *)view; - (void)insertSubview:(UIView *)view belowSubview:(UIView *)siblingSubview; - (void)insertSubview:(UIView *)view aboveSubview:(UIView *)siblingSubview;
- (void)bringSubviewToFront:(UIView *)view; - (void)sendSubviewToBack:(UIView *)view;
The sibling views are ordered back to front in the subviews array. So the topmost view will be:
[parentView.subviews lastObject];
and bottom view will be:
[parentView.subviews objectAtIndex:0];
[parentView bringSubviewToFront:view] will bring the view to the top, but this is only the …

How to disable all caps menu titles in Visual Studio

Visual Studio 2012 (Full)
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\General DWORD: SuppressUppercaseConversion Value: 1
In PowerShell, you can run this to set that registry key and the uppercase goes away.
Set-ItemProperty -Path HKCU:\Software\Microsoft\VisualStudio\11.0\General -Name SuppressUppercaseConversion -Type DWord -Value 1
Visual Studio Express 2012
Set-ItemProperty -Path HKCU:\Software\Microsoft\VSWinExpress\11.0\General -Name SuppressUppercaseConversion -Type DWord -Value 1
Visual Studio Express 2012 for Web
Set-ItemProperty -Path HKCU:\Software\Microsoft\VWDExpress\11.0\General -Name SuppressUppercaseConversion -Type DWord -Value 1
Visual Studio 2013
Replace 11.0 with 12.0 in the registry keys above.
Visual Studio 2015 Developer Preview
Replace 11.0 with 14.0 in the registry keys above.
I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below …

Storyboard Reference, Strong IBOutlet, Scene Dock in iOS 9

Apple has done some optimization in both Xib and Storyboard files. And because of this optimization, you can now define an IBOutlet as strong, instead of weak. Apple pointed this out at the last WWDC, so let's give a look at this in more details. You can find in the documentation the chapter Managing the Lifetimes of Objects from Nib Files:
✔ Read More...
I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.

This arti…

Swift vs. Objective-C: 10 reasons the future favors Swift

Programming languages don't die easily, but development shops that cling to fading paradigms do. If you're developing apps for mobile devices and you haven't investigated Swift, take note: Swift will not only supplant Objective-C when it comes to developing apps for the Mac, iPhone, iPad, Apple Watch, and devices to come, but it will also replace C for embedded programming on Apple platforms.
✔ Read More...
I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share yo…

How to get list of all founts available in iOS SDK

T
o get list of all founts available in iOS SDK, use the following code,

// List all fonts on iPhone
NSArray *familyNames = [[NSArrayalloc] initWithArray:[UIFontfamilyNames]]; NSArray *fontNames; NSInteger indFamily, indFont; for (indFamily=0; indFamily<[familyNames count]; ++indFamily)     { NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]);         fontNames = [[NSArrayalloc] initWithArray:                      [UIFontfontNamesForFamilyName:                       [familyNames objectAtIndex:indFamily]]]; for (indFont=0; indFont<[fontNames count]; ++indFont)         { NSLog(@"    Font name: %@", [fontNames objectAtIndex:indFont]);         }         [fontNames release];     } [familyNames release];
I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful t…

Today iOS Development Resources, Articles, Tutorials and Open Sources

Today iOS Development Resources, Articles, Tutorials and Open Sources

1. Open Source iOS Control For Making Great Looking Customizable Information Badges

An open source control for making some great looking custom badge views, that can be used as accessory views in a UITableView - or anywhere you want.  Customize size, shape, color and more.


You can find MLPAccessoryBadge on Github here.

A very slick control that has many potential uses.

2. Open Source iOS UI Control For Creating Great Looking Gauges

An open source library allowing you to create great looking needle gauges with a nice flat minimalistic style.


The included demonstration application shows how to make several styles of gauges and how to use them.

You can find MSSimpleGauge on Github here.

A nice control for creating some great looking gauges.

3. UICollectionView Layout That Automatically Organizes Things In A Linear Manner Based On Content Size

A UICollectionView layout inspired by Google Plus that automatically lays out your vie…

Today iOS Development Resources, Articles, Tutorials and Open Sources

Today iOS Development Resources, Articles, Tutorials and Open Sources

1. Open Source iOS Paging Control With Beautiful Paper Fold Transitions

An open source paging control allowing you to easily set up a nifty gesture responsive view for quickly going through multiple pages with slick paper folding transitions.

You can find PaperFoldGallery on Github here.

A great way to present content across multiple pages.

2. Library Allowing You To Easily Add Drag And Drop Between UIViews – Even Popover Views

A library allowing you to add drag and drop to functionality to UIViews even popover views.

You can find OBDragDrop on Github here.

A nice easy way to implement drag and drop functionality between UIViews.

3. Nifty iPhone App Allowing You To Turn Hand Drawn App Mockups Into Interactive Prototypes

An iPhone app that allows you to quickly take hand drawn app mockups and turn them into interactive app prototypes.


You can find POP – Prototyping On Paper and download it free on the App Store here.

4. Tool: Ma…