Getting started with iOS
UILabel
Change Status Bar Color
Passing Data between View Controllers
Managing the Keyboard
UIButton
UILocalNotification
UIImageView
Checking for Network Connectivity
Accessibility
UITableView
Auto Layout
UIView
UIAlertController
MKMapView
UIColor
NSAttributedString
CAAnimation
UITextView
UINavigationController
Concurrency
CAGradientLayer
UIGestureRecognizer
Custom UIViews from XIB files
Safari Services
UIStackView
UIImage
UIWebView
CALayer
Swift and Objective-C interoperability
NSDate
Custom Fonts
AVSpeechSynthesizer
UIBarButtonItem
UIScrollView
Localization
NSNotificationCenter
UITextField
Networking with Alamofire
UIViewController
iBeacon
CLLocation
NSURLSession
UISwitch
Checking iOS version
Universal Links
UICollectionView
PDF Creation
In-App Purchase
NSTimer
CGContext
UITabBarController
UISearchController
UIActivityViewController
Core Location
FacebookSDK
AFNetworking
CTCallCenter
UIImagePickerController
NSUserDefaults
UIControl - Event Handling with Blocks
UIBezierPath
UIPageViewController
UIAppearance
Push Notifications
Key Value Coding
Initialization idioms
Storyboard
Background Modes and Events
Fastlane
CAShapeLayer
WKWebView
UUID Universally Unique Identifier
Categories
Handling URL Schemes
Realm database
ARC Automatic Reference Counting
UIPickerView
Dynamic Type
NSURL
SWRevealViewController
Snapshot of UIView
DispatchGroup
GCD Grand Central Dispatch
Size Classes and Adaptivity
UIScrollView, AutoLayout
IBOutlets
AWS SDK
Debugging Crashes
UISplitViewController
UISplitViewController
UIDevice
CloudKit
GameplayKit
XCode Build Archive From Command Line
Unit Testing with XCTest
NSData
AVPlayer and AVPlayerViewController
Deep Linking
App Transport Security (ATS)
Core Graphics
Segues
UIDatePicker
NSPredicate
EventKit
NSBundle
SiriKit
Contacts Framework
Dynamically updating a UIStackView
Speech Recognition
NSURLConnection
StoreKit
Code signing
.ipa file to upload on appstore with ApplicationLoader
Resizing UIImage
Size Classes and Adaptivity
MKDistanceFormatter
3D Touch
GameCenter Leaderboards
Keychain
Handle Multiple Environment using Macro
Set View Background
Block
Content Hugging
Google Places API
Navigation Bar
UITextField Delegate
App-wide operations
UILabel text underlining
Cut a UIImage into a circle
Make selective UIView corners rounded
Convert HTML to NSAttributed string and vice versa
Convert NSAttributedString to UIImage
CoreImage Filters
Face Detection Using CoreImageOpenCV
MPMediaPickerDelegate
Graph Coreplot
NSHTTPCookieStorage
FCM Messaging
Create Custom Framework
Custom Keyboard
AirDrop
SLComposeViewController
AirPrint tutorial
UISlider
Carthage
HealthKit
Core SpotLight
UI Testing
Core Motion
QR Code Scanner
plist
NSInvocation
UIRefreshControl TableView
WCSessionDelegate
AppDelegate
App Submission Process
MVVM
UIStoryboard
Basic text file I/O
Text To Speech (TTS)
MPVolumeView
Objective-C Associated Objects
Passing Data between View Controllers
UIPhoenix
Blocks in Queue with MKBlockQueue
Simulator
BackgroundModes
NSArray
OpenGL
UIScrollView with StackView child
Cache online images
MVP Architecture
UIKit Dynamics
Configure Beacons with CoreBluetooth
Core Data
Extension for rich Push Notification
Profiling with Instruments
Application rating review request
MyLayout
UIFont
Simulator Builds
Simulating Location Using GPX files
Custom methods of selection of UITableViewCells
Custom methods of selection of UITableViewCells
UISegmentedControl
SqlCipher integration
Custom UITextField
Custom UITextField
Security
Guideline to architecture patterns
UIFeedbackGenerator
UIKit Dynamics with UICollectionView
Multicast Delegates
Using image assets
UITableViewCell
Runtime in Objective-C
ModelPresentationStyles
CydiaSubstrate tweak
Create a video from images
Codable
FileHandle
NSUserActivity
Rich Notifications
Load images async
Adding Swift bridging header
Creating an App ID
Changing the rootview controller
Attributed text in UILabel
attributedText in UILabel
HTML text in UILabel
Set different property to text in single UILabel
UITableViewController
Contributors

Set different property to text in single UILabel

suggest change

The first step you need to preform is to create a NSMutableAttributedString object. The reason we create a NSMutableAttributedString instead of NSAttributedString is because it enables us to append string to it.

NSString *fullStr = @"Hello World!";
NSMutableAttributedString *attString =[[NSMutableAttributedString alloc]initWithString:fullStr];

// Finding the range of text.
NSRange rangeHello = [fullStr rangeOfString:@"Hello"];
NSRange rangeWorld = [fullStr rangeOfString:@"World!"];

// Add font style for Hello
[attString addAttribute: NSFontAttributeName
                  value: [UIFont fontWithName:@"Copperplate" size:14]
                  range: rangeHello];
// Add text color for Hello
[attString addAttribute: NSForegroundColorAttributeName
                  value: [UIColor blueColor]
                  range: rangeHello];

// Add font style for World!
[attString addAttribute: NSFontAttributeName
                  value: [UIFont fontWithName:@"Chalkduster" size:20]
                  range: rangeWorld];
// Add text color for World!
[attString addAttribute: NSForegroundColorAttributeName
                  value: [UIColor colorWithRed:(66.0/255.0) green:(244.0/255.0) blue:(197.0/255.0) alpha:1]
                  range: rangeWorld];

// Set it to UILabel as attributedText
UILabel * yourLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 150, 200, 100)];
yourLabel.attributedText = attString;
[self.view addSubview:yourLabel];

Output :

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Set different property to text in single UILabel

Table Of Contents
13 UIView
31 NSDate
80 NSURL
97 NSData
102 Segues
107 SiriKit
123 Block
142 AirDrop
152 plist
158 MVVM
169 NSArray
170 OpenGL
181 UIFont
201 Codable