[Original] obj-c Programming 16: Key-value encoding (KVC)
Original article: obj-c Programming 16: Key-value encoding (KVC)
We can use the Key-Value encoding (KVC, Key-Value Coding) in obj-c to access class attributes, and specify the attribute
1. Create and start a thread. An NSThread object represents a thread. Create and start a thread.
NSThread *thread = [[NSThread alloc] initWithTarget:self selector:@selector(run) object:nil];[thread start];2. Thread-related usage main thread-related
(1) pragma mark
1. Definition
# The code starting with pragma is a compiler instruction, which is a program or compiler-specific instruction. Not necessarily applicable to other compilers or other environments. If the compiler cannot recognize this
Today we will introduce swift functions, swift functions and c # And js statements, but they are quite different from object-c statements. Let's just get started.
1: function -- constant parameter
Func function name (parameter variable: type,
The content includes image watermark, image cropping, screen, and background tile.
1. Image Watermark Function
# Import "UIImage + MJ. h "@ implementation UIImage (MJ) + (instancetype) waterImageWithBg :( NSString *) bg logo :( NSString *) logo
During iOS development, we usually use UINavigationController, UITabbarController, and other view controllers provided by Apple to switch our views. Before iOS5, it is difficult to customize the container View Controller. For example, you need to
(1) UseTouchJSonResolution Method: (the package needs to be imported: # import TouchJson/JSON/CJSONDeserializer. h)
// Use TouchJson to parse the weather in Beijing-(IBAction) btnPressTouchJson :( id) sender {// obtain the api nsurl * url = [NSURL
Object Archiving:
Concept:
Object archiving refers to writing objects to a file and saving them on the hard disk. When you re-open the program, you can restore these objects. It is also called object serialization and Object persistence.
Data
In iOS development, you can play a video in either of the following ways: MPMoviePlayerController (you need to import MediaPlayer. Framework) or AVPlayer. For the differences between the two classes, refer to examples. This blog mainly introduces
Use CocoaPods to manage an FMDB-based project class library as usual
Command Line execution
$ Pod install
[!] The 'master' repo requires CocoaPods 0.32.1-
Failed, prompting CocoaPods 0.32.1
View CocoaPods version
$ Pod -- version
0.2
BUG Description: Direct access to objective-c's isa is deprecated in favor of object_setClass () and object_getClass ()
Solution: In Build Settings of target, Change Build ActiveArchitecture Only to YES.
Processing result: running successfully
Other
1. In this case, the device type is obtained at a higher level. iPhone, iPod, and iPad are returned. Suitable for low requirements.
NSString *deviceType = [[UIDevice currentDevice] model];
2. This is the method for obtaining the device type in
Java is used for IOS push. There are two famous open-source jar packages: javapns and notnoop.For javapns, we have previously introduced Memory leakage. This problem is serious, as shown in:1. The pushed consumer y will be saved and not recycled.2.
Recently, the company made an application and assigned me a push module. At the beginning, it was quite simple. Third-party libraries have everything and do not have to deal with APNS directly. Later, the more you write, the more you find, the less
Imitating the iphone address book
The project has previously implemented the pinyin sorting Address Book Design. Now you can search for the address book.
The original interface is as follows:
The search function depends on uisearchbar
1. _ advantages of the weak modifier, in addition to solving the problem of loop reference, when holding a weak reference of an object, if the object is discarded, this weak reference will automatically expire and be in the nil assigned State (null
Let's talk about the adaptation between different ios versions.
Let's talk about one thing first: In xcode, there is one thing called targets. Apple's official documentation says this:
A target specifies a product to build and contains the
Two days ago, iOS7.1 was officially released. This release has brought about a huge change, which is a huge waste for all iOS enterprise developers, because the original HTTP application publishing method is no longer effective.
This change was not
Create
Singleton.h
- ()playSoundWithName:(NSString *
Add the sound effects used by the APP to the newly created bound.
Create
Singleton.m
*_soundDict; - (= _soundDict =
The system sound service uses SystemSoundID to play
Strong: applies to OC objects. It acts the same as retain in non-ARC objects. Its Modified member variables are strongly pointer-type weak: applies to OC objects and works the same as assign in non-ARC objects, modified member variables are weak
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service