Editing the UI to Improve the UX
Master iOS UX with Professional Loading States
Essential UX Components for iOS Apps
Loading Indicators
Visual feedback during data loading prevents user frustration. Apple's UIActivityIndicatorView provides a familiar spinning animation that users expect to see.
Pull-to-Refresh
Standard iOS gesture allowing users to manually refresh data. This empowers users to control their experience when content seems outdated.
Apple has defined the concept of good user experience and certain things are expected by users. Failing to meet these expectations causes frustration and leads to users abandoning your app.
Impact of Poor vs Good Loading UX
Project Setup for New Participants
Navigate to Class Files
Close any open files and go to Desktop > Class Files > yourname-iOS Dev Level 2 Class
Duplicate Project Folder
Find 'Jive Factory Ready for Improving the UX' folder and create a duplicate copy
Rename and Open
Rename the duplicated folder to 'Jive Factory' and open Jive Factory.xcworkspace
UIActivityIndicatorView Implementation
Spinner Creation
UIActivityIndicatorView with gray style provides a standard Apple loading indicator. Users immediately recognize this familiar interface element.
Positioning Logic
Frame calculation centers the 40x40 pixel loader using view dimensions. Mathematical centering ensures consistent placement across device sizes.
Animation Control
startAnimating begins the spinner, stopAnimating ends it when data loads. Proper timing prevents unnecessary animation overhead.
Loader Implementation Process
Create Loader Instance
Initialize UIActivityIndicatorView with gray style in viewDidLoad method
Set Frame Position
Calculate center position using view dimensions and set 40x40 pixel frame
Add to View Hierarchy
Use addSubview to make loader visible on screen
Start Animation
Call startAnimating to begin the spinning animation
Stop on Completion
Call stopAnimating within fetch completion handler when data loads
The spinner will only flash for a second before data loads. Pay close attention to the Simulator to catch the loading animation in action.
Pull-to-Refresh Implementation
Enable in Storyboard
Select Bands scene in Main.storyboard and set Refreshing to Enabled in Attributes inspector
Add Target Action
Connect refreshControl to refresh method using addTarget for UIControlEvents.valueChanged
Create Refresh Method
Implement refresh function that clears existing data using removeAll
Fetch New Data
Call bandsModel.fetch again to reload fresh data from the server
End Refresh Animation
Call endRefreshing instead of stopAnimating to properly dismiss pull-to-refresh indicator
With WiFi enabled, run the app and drag the table cells down to reveal the animated refresh loader. This simulates the standard iOS refresh gesture users expect.
Key Takeaways
