Tuesday, July 31, 2018

Set a spacing before the first and after the last view inside a UIStackView

We can set spacing between UIStackView's arranged subviews easily by setting the spacing for the UIStackView. But to give a padding before the first item and after the last item, the easiest way seems to be setting layout margins for the UIStackView

Wednesday, July 11, 2018

UIStackView not showing some of the subViews

When a sub view of a UIStackView doesn't have an intrinsic content size, the UIStackView might not even display it in the UI. So if your subview is missing, try applying constraints to define the position and size of the subview.

Friday, March 16, 2018

strip-frameworks.sh file not found

This is because the compiler is trying to run the script within the embedded framework before actually embedding the framework itself. Reorder the default build phases to fix this:

Clean the build folder.
[Press option button and Product -> Clean]

Under 'Build Phases', Move the 'Embed Frameworks' section to above the 'Run Script' phase.



Monday, February 19, 2018

expr - Modify objects at runtime!!
If you want to modify a live object from the debugger, you can use expression(or just expr) to modify their properties on runtime using memory addresses
'expr' is used to evaluate runtime expression in debugger
(lldb) expr ((UIView *)0x7fac07a456b8).backgroundColor = [UIColor redColor]

Friday, September 8, 2017

Realm/RLMArray.h file not found and Could not build Objective-C module 'Realm'

Run Clean Build Folder...(Hold down option while clicking Product in the Xcode menu shows the Clean Build Folder...option) it fixes the issue for me

Courtesy : https://github.com/realm/realm-cocoa/issues/3551

Monday, September 4, 2017

iOS UIScrollViews have extra space on top


From iOS 7 onwards, a ViewController's view starts at absolute position (0,0), which means it's underneath the Nav Bar. 

So if we have a tableView or any other type of Scroll view in the View, the there is a chance that the top content might get hidden by the top bars. So ViewControllers automatically adjust the content inset of subviews which are of type UIScrollView to consider the space taken by the bars. 

If the ViewController is inside a NavigationController, the space typically is 64 (20 for the status bar + 44 for the Navigation Bar). Otherwise it's just 20, for the Status Bar

We can disable this automatic adjustment by setting: 

self.automaticallyAdjustsScrollViewInsets = NO;



This just got deprectated in iOS 11. The new method to fix this is : 

scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever

Wednesday, July 12, 2017

UICollectionView Sticky Headers & Footers

From iOS 9, UICollectionViewFlowLayout has two very handy properties to pin the header & footer to the top/bottom of the collection view bounds

1. sectionHeadersPinToVisibleBounds

When this property is true, section header views scroll with content until they reach the top of the screen, at which point they are pinned to the upper bounds of the collection view. Each new header view that scrolls to the top of the screen pushes the previously pinned header view offscreen. 

2. sectionFootersPinToVisibleBounds

When this property is true, section footer views scroll with content until they reach the bottom of the screen, at which point they are pinned to the lower bounds of the collection view. Each new footer view that scrolls to the bottom of the screen pushes the previously pinned footer view offscreen.