Posts

Showing posts from August, 2019

Dynamic height of cell based on user typing the text iOS swift || textview dynamic height iOS

Solution: If you wants to adjust the height based on your textview text then below the steps will be easy to achieve that, Also if you are using tableview also easy to do that.Using autolayout for wrap content like in android. first you have to set the constraints to the textview without height because height will be adjustable.Except height you can give all the constraints then in tableview delegate methods must implement that row height will be autodimention. after that you can enjoy with the dynamic height tableview

Google drive google docs not able to paste the image it shows esclamatory symbol

Solution: If you are copy the image from one drive to another then it shows like that. MAC: So if you are using the mac system then download your file as docx format to your system and open it via pages app. After that copy the image from drive paste it in your file in pages then upload it into your google drive. Then it will works. WINDOWS: So if you are using the windows system then download your file as docx format to your system and open it via microsoft word app. After that copy the image from drive paste it in your file in pages then upload it into your google drive. Then it will works.

UITextField with underline iOS swift

Solution: If you had a textField that wants to be underlined follow the below steps you can achieve. 1. First you have to choose your textfield as custom in your storyboard. 2. Then add an extension to textfield 3. Then assign the delegate to the textfield.call your custom function and then enjoy with the underline. Coding: // MARK: uitextField extension UITextField {     func underlined(){         let border = CALayer ()         let lineWidth = CGFloat ( 0.3 )         border. borderColor = UIColor . darkGray . cgColor         border. frame = CGRect (x: 0 , y: self . frame . size . height - lineWidth, width:   self . frame . size . width , height: self . frame . size . height )         border. borderWidth = lineWidth         self . layer . addSublayer (border)         self . layer . ...

Sort an NSMutablearray with custom objects in iOS

Solution: You can use sortdescriptor to sort an array of objects. NSSortDescriptor *sortDesc; sortDesc = [[NSSortDescriptor alloc] initWithKey:@"createdDate"                                            ascending:YES]; NSArray *sortArr = [arrayDetails sortedArrayUsingDescriptors:@[sortDesc]];

right gesture tap action tableview iOS swift || Get the action for swipe close in uitableview

Solution: If you want to call some set of codes after the swipe action user had tapped on the screen and swipe options close use the below code.     func tableView( _ tableView: UITableView , didEndEditingRowAt indexPath: IndexPath ?) { //inside code to handle the tap after swipe }

iOS tableView cell loading incorrectly with empty space swift

Solution: If you had any changes in the cell and reloaded the particular section or particular row then it will have some set of issues. So better you can use the tableview reloaddata function to solve this.

iOS latest Interview Questions

1) Difference between cocoa and cocoa touch ? Both are used for developing apps in OSX and iOS Cocoa had foundation and appkit frameworks.Cocoa Touch had UIKit and foundation frameworks 2)Which json framework supported by iOS? SBJSON is supported by iOS 

When click the notification generated from my app crashes and goback to appdelegate iOS swift

Solution: If it went back to appdelegate then just watch the log that produced.If it had any array issues then put the breakpoint and goto step by step and solve it. First you have to check with didfinishLaunching method in app delegate.Then check with notification delegate methods.After that you cannot find then check with didenterforeground and didenterbackground methods in appdelegate.It's easy after that you can solve.

Disable the screen Lock when audio recording iOS

Solution: If you are recording the audio when your app is on use and don't had any actions performed only recording will happen then if your screen lock time is some seconds that time screen will be locked. So try the below code code to disable the screen lock when audio is recording.When audio record started the call the below code. Objective C: [UIApplication sharedApplication].idleTimerDisabled = YES; Swift:   UIApplication . shared . isIdleTimerDisabled = true In didfinishrecording call the below code Objective C: [UIApplication sharedApplication].idleTimerDisabled = No; Swift:   UIApplication . shared . isIdleTimerDisabled  =  false

Remove the lines below the empty tableView iOS swift and objective C

Solution: If you want to remove the empty cell spaces below the code then use the code to remove the lines in the empty tableView Swift 5:     override func viewDidLoad() {         super.viewDidLoad()         mytblView.tableFooterView = UIView()     } Objective C: - (void) viewDidLoad {   [super viewDidLoad];   self. mytblView.tableFooterView = [UIView new]; }

Insert the indexpath row in iOS swift and Objective C

Solution: If you want to add the index in the row without reloading the entire tableView then use the below code. Swift: tableView.beginUpdates() tableView.insertRows(at: [IndexPath(row: yourArray.count-1, section: 0)], with: .fade) tableView.endUpdates() Objective C: [self. tableView beginUpdates]; NSArray *arr = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:Yourarray.count-1 inSection:0]]; [self. tableView insertRowsAtIndexPaths:arr withRowAnimation:UITableViewRowAnimationAutomatic]; [self. tableView endUpdates];