1. Understand the delivery of touch events (the response chain of events)
Responder chain
Only classes that inherit from UIResponder can respond to touch events. As you can see from the responder chain above, the top view responds first. If the view has a view controller, it will be the next responder; otherwise, it will be the view’s parent view. Up to the singleton UIWindow object, and then finally the singleton UIApplication object to terminate, and the next responder of UIApplication is nil, so that completes the response loop. The view can determine whether an event needs to be responded to during delivery.
Event Delivery
The First responder is the responder object (usually a UIView object) that is currently being touched, indicating that the object is currently interacting with the user, and it is the beginning of the responder chain. The mission of the entire responder chain and event distribution is to find the first responder.
The UIWindow object sends the event as a message to the first responder, giving it the opportunity to process the event first. If the first responder does not process, the system passes the event (via message) to the next responder in the responder chain to see if it can process.
When the iOS system detects the Touch operation, it will package it into a UIEvent object and put it into the event queue of the current active Application. The UIApplication of the singleton will take out the Touch event from the event queue and pass it to the UIWindow of the singleton for processing. The UIWindow object will first use the hitTest:withEvent: method to find the View at the initial point of the Touch operation. That is, the View to which the Touch event needs to be passed. This process is called hit-test View.
UIWindow instance object will first call hitTest:withEvent: on its content view. This method will call pointInside:withEvent: on each view in its view hierarchy: To determine if the user clicked on the current view), and if pointInside:withEvent: returns YES, the call continues until it finds the hit-test view where the touch operation occurred.
The hitTest:withEvent: method is processed as follows
:
The current view’s
The pointInside:withEvent: method determines whether the touch point is in the current view;
If the return
NO, hitTest:withEvent: returns nil;
If the return
YES, hitTest:withEvent: message is sent to all subviews of the current view. The traversal sequence of all subviews is from the topmost view to the bottom view, that is, traversal from the end of the subviews array until some subviews return non-empty objects or all subviews are traversed.
If the first time a subview returns a non-empty object
The hitTest:withEvent: method returns this object, and processing is complete;
If all subviews return no, then
HitTest :withEvent: Method returns itself (self).
Fame, Bounds, Center, Alpha, Opaque,hidden
So these are some of the basic properties of a View. A frame is a region of the view in its parent view. Its coordinate system is the coordinates in its parent view. We use frame a lot when we initialize a view. Bounds also describes the size of the view, its position in its own coordinate system. Center is the coordinate that describes its central position in the superview. We use Center when we change the position of the view without changing its size. Alpha is used to describe the transparency of the view from 0 to 1, 0 being transparent and 1 being opaque. Alpha supports animation. Alpha = 0 has the same effect as hidden = YES, but the latter is more expensive. The View accepts the touch event when alpha equals 0, but hidden does not. Also hidden and Apaque don’t support animation. Alpha does not affect the behavior of views embedded within it, while Hidden does. When the View is set to a transparent background, Opaque is set to NO to reduce overhead and optimize memory. Opaque affects the drawing system. Setting it to YES will optimize the drawing of the view.
Nil,NSNULL,NULL difference
Nil is a null pointer to an object in obj-C. It’s an object. In O-C, a ni object calling a method does not cause a crash.
Nil is a null pointer to a class in obj-c, representing an empty class.
NULL is a NULL pointer to any type (such as a NULL pointer in C/C ++), and is a number in Objective-C.
NSNULL is used for collection operations and, in collection objects, represents a null-valued collection object.
4.KVC and KVO
Key-value-coding (KVC) is a mechanism for indirectly manipulating object attributes and setting values for attributes. The setValue: forKey: and valueForKey are used to access and access attributes.
Key-value-observing (KVO), which uses the observer mode to observe property changes and notify registered observers. Observing objects through registration addObserver: forKeyPath: options: context: class must be rewritten and observer method observeValueForKeyPath: ofObject: change: context:. In the MVC model, when the database (dataModal) changes, the view changes.
5.NSThread,NSOperation,GCD
NSThread,NSOperation,GCD is one of the three ways to use multiple threads in IOS. They each have their advantages and disadvantages. The level of abstraction is from low to high, and the higher the abstraction, the easier it is to use.
Disadvantages of NSThreads: You need to maintain the thread life cycle and synchronization and mutual exclusion of threads, but these need to consume system resources. Pros: Lighter than the other two.
NSOperation, advantages: you do not need to manage the thread life cycle, thread synchronization and mutual exclusion, etc. You just need to focus on your own business logic processing and you need to use it with NSOperationQueue.
GCD is a multi-core programming solution developed by Apple. Advantages: It is more efficient and powerful than the first two.
6. Autorelease,ARC and non-ARC
Autorelease is automatically released, and is associated with an autorelease pool (NSAutoReleasePool). Autorelease variables are put into the autorelease pool. When the autorelease pool is released (drain), the autorelease variable in the autorelease pool is released. Ios applications are created with a default NSAutoReleasePool that will be destroyed when the application exits. But for each RunLoop, an AutoReleasePool is implicitly created, and all release pools form a stack structure. At the end of each RunLoop, the pool at the top of the stack is destroyed.
ARC, automatic application count. (added in iOS 6) iOS memory management is based on variable application counts. So the system manages the release, retain, etc for you.
Non-arc, non-automatic application count. Manage memory manually. Be responsible for release, retain and other operations of system variables. Do who allocates who releases, and alloc and release like corresponding. Function returns an object using autoRelease.
You can use Xcode to convert non-arc to ARC, and mix ARC and non-Arc. You can use the -fno-objc-arc, -fobjc-arc tags when compiling ARC. The actual situation depends on whether the project supports ARC mode or not.
Xib, storyboard, manual writing code
Xib (Interface builder), which facilitates interface editing. You can directly add a variety of views on the window, advantages: directly see the effect of the interface, simple operation. Disadvantages: Not convenient to dynamically control the view, inflexible.
Manual code, inheritance (mainly UIView, UIViewController), advantages: you can customize the view, flexible control is convenient. Disadvantages: can’t see the effect immediately, complex.
Storyboards (storyboards are coming in ios6). Advantages: can see the interface effect, can simultaneously carry out multiple interface interaction, efficient and fast. Disadvantages: can’t carry out interface customization, but laugh flexibility.
Xib and storyboard are mainly used to fix the position of elements in the interface and to figure out what elements are in it. But if you need to change the interface dynamically, it’s better to write the code manually. It is generally used in a mixture of ways.
8.loadView,viewDidLoad,ViewDidUnload,viewWillAppear,viewDidAppear,viewwilldDisappear,viewDidDisappear
LoadView is called manually when the interface is created when the VIEW’s NIB file is nil, and implemented in viewDidLoad when the View’s NIB file exists. But when your program runs out of memory and the view controller receives a didReceiveMemoryWarning, the system checks to see if the current view controller’s view is still in use, and if not, the view is released and loadView is called again to create a new view. ViewDidLoad, whether it’s loading a view from a XIB or generating a view from a LoadView, is called. But if the view is displayed next time on the stack, it will not be called. ViewWillAppear, ViewDidAppear is going to be called every time the view is about to be visible and fully displayed. We’re going to do a little bit of preparation for view display inside ViewWillAppear, ViewDidDi SAppear and ViewWillDisAppear are going to be called every time the view disappears. When the system gets a didReceiveMemoryWarning that it is out of memory, ViewDidUnload is called to clean up the data in the View and post release to nil.
9. The difference between copy and retain
Retain, equivalent to a pointer copy. The reference count of a variable is incremented by one. The other pointer also points to the change address.
Copy, equivalent to content copy. The reference count of a variable is incremented by one. But the count itself doesn’t change. Create another address space to put the value of the same variable in.
Write setter and getter methods manually
- (void) setOldValue: (NSString*) newValue {
if (newValue ! =oldValue) {
[oldValuerelease];
oldValue = [newValueretain];
}
Copy the code
}
11. NSRunLoop and NSOperationQueue
NSRunLoop is a collection of all input and timing sources to monitor and registered observers to notify. An input source used to handle mouse, keyboard events, etc. Each thread has its own RunLoop that the system creates automatically. You shouldn’t build it yourself, you can only get it. NSRunLoop is generally not used because it is not thread-safe. We usually use CFRunLoop, which is thread-safe, which is a message processing mode that we don’t normally have to deal with.
NSOperationQueue is a queue that manages NSOperations. We’re going to put NSOperation in a queue and manage it.
12. Common design patterns for IOS
The singleton pattern, DeafutCenter, Deafultqueue, etc
MVC pattern,View, Model,ViewController.
Observer mode, notification, KVO
Factory model,
Proxy mode, delegate
13. Memory management and optimization
Principle:
1.1 Who creates, who releases (similar to “he who pollutes, he who cures”). If you create an object by alloc, new, or copy, then you must call release or autoRelease. In other words, if you don’t create it, you don’t have to release it.
For example, if you alloc an object in a function and the object is only used in that function, you must call release or autoRelease in that function. If you alloc a member object in a class method without calling autoRelease, you need to call release in that class’s dealloc method. If autoRelease is called, nothing needs to be done in the dealloc method.
1.2 All objects created by methods other than alloc, new, or copy are declared autoRelease.
1.3 Who retains and who releases? Whenever you call retain, no matter how the object was generated, you call release. Sometimes you don’t have a retain in your code, but the system will include a retain in the default implementation.
Optimization:
When receiving a didReceiveMemoryWarning for memory, release some resources that are no longer needed, paying attention to coding specifications such as variables that are not in use requiring timely release. Avoid occupying too much memory space, sometimes need to use space to exchange time, try to use some efficient algorithms and data structure to save memory space. Finally, find memory leaks and allocations (instrument, Leaks, Allocations) using some memory detection tools and static analysis of your code.
14. Optimization of TableView
Optimization:
1.1 Correctly Reuse Cells.
1.2 Reduce the processing logic and processing time in returning each cell. Cache and reuse data as much as possible.
1.3, minimize processing load and calculation time, do not block the UI thread.
1.4, draw each cell as much as possible.
1.5: Set the Opaque property of each cell.
1.6, try to return a fixed height for each row.
1.7, reduce graphic effects in each cell.
1.8. Load data in segments.
Opengl, Quatarz 2D
The above two methods are the techniques used for graphic rendering.
Quatarz 2D is a basic graphics tool library provided by Apple based on Core Graphic. Easy to operate, can meet most needs. It is only suitable for 2D graphics drawing.
Opengl is a cross-platform graphics development library. Suitable for 2D and 3D graphics drawing. Powerful but complex.
16, animation
IOS provides rich Core Animation to meet the needs of users, mainly in the following three ways:
1.1 commitAnimations use UIView animations
UIView Animations:
[UIView beginAnimations:@”animationID” context:nil];
[UIView setAnimationDuration: 0.5 f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationRepeatAutoreverses:NO];
// There are four effects
/ *
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES]; //oglFlip, fromLeft
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES]; //oglFlip, fromRight
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view cache:YES];
* /
// Your own operation
[UIView commitAnimations];
1.2, CATransition
CATransition*animation = [CATransitionanimation];
Animation. Duration = 0.5 f;
animation.timingFunction=UIViewAnimationCurveEaseInOut;
animation.fillMode= kCAFillModeForwards;
animation.type= kCATransitionMoveIn;
animation.subtype= kCATransitionFromTop;
[self.window.layeraddAnimation:animationforKey:@”animation”];
/ / Own operations
1.3, UIView animateWithDuration
+(void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations;
- (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion; // One more animation can be performed after the end of the operation.
[UIView animateWithDuration: 1.25 animations: ^ {
CGAffineTransform newTransform = CGAffineTransformMakeScale (1.2, 1.2);
[firstImageView setTransform:newTransform];
[secondImageView setTransform:newTransform]; }
completion:^(BOOL finished){
[UIView animateWithDuration: 1.2 animations: ^ {
} completion:^(BOOL finished){completion}];
}];
17. Customize the View
You need to inherit your own rich classes from cocoa Touch. (UIView, UiScrollView, UITableView, etc.). You need to override drawRect, touch events, init, initFrame, etc.
18. The core Data, sqlite, file, NSUserDefaults
The above four are the ways to access data in IOS.
Core Data, SQLite involves databases. Sqlite needs to operate the database through SQLite statements, while Core Data is a more abstract object based on SQLite provided by Apple.
File, mainly storing data on disk. By writing and reading files.
NSUserDefaults is basically an application that stores lightweight data like Settings and properties of the application and user information.
19. Adaptation of models and sizes
The main Iphone sizes are 3.5 and 4 inches. Resolution: 320480,480960 (retina).
The main IPad sizes are 7.9 and 9.7 inches. Resolution: 1024768,20481536 (retina).
20. Adding gestures (Gesture and Touches)
1. Reload the ‘touchMoved,’ ‘touchBegin,’ ‘touchEnd,’ ‘touchCanceled’ event yourself.
2. Add the AddGestureRecognier event using UIGestureRecongnizer. This method makes it easy to add basic gesture events such as click, double click, drag, etc.
21. The life cycle and state of the application (reference: blog.csdn.net/totogo2010/…
The program is Not started
Inactive the Inactive program runs in the foreground, but receives no events. Programs typically stay in this state without event handling
The Active activator runs in the foreground and receives events. This is also a normal pattern for the foreground
Background daemons are in the background and can execute code. Most programs enter this state and stay there for a while. When the time is up, it will enter the Suspended state. Some programs can be in the Backgroud state for a long time after special requests
A Suspended program cannot execute code in the background. The system automatically changes the program to this state without notification. When suspended, programs remain in memory, and when system memory is low, the system removes pending programs to provide more memory for foreground programs.
Below is the program state change diagram:
Callbacks to the agent when each program is running:
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions
Tells the agent that the process is started but has not entered state saving
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
Tell the agent to start the basic completion program ready to run
- (void)applicationWillResignActive:(UIApplication *)application
When an application is about to execute in an inactive state, during which time the application does not receive messages or events, such as a phone call
- (void)applicationDidBecomeActive:(UIApplication *)application
This is the opposite of the above method when the application is active
- (void)applicationDidEnterBackground:(UIApplication *)application
Called when the application is pushed to the background. So to set the background to continue running, you can set it in this function
- (void)applicationWillEnterForeground:(UIApplication *)application
Called when the program is about to return to the foreground from the background, this is the opposite of the above method.
- (void)applicationWillTerminate:(UIApplication *)application
Called when the program is about to exit, usually to save data and do some cleanup before exit. The need to set up the UIApplicationExitsOnSuspend key values.
- (void)applicationDidFinishLaunching:(UIApplication*)application
Execute when the program is loaded
Load the application into the foreground
Load the application into the background
22. The block programming
A Block is an embedded Block of functions with anonymous functionality. Blocks are commonly used to represent or simplify a small piece of code. They are particularly useful for creating a piece of code that executes synchronously, encapsulating a small piece of work, or serving as a callback when a job is completed. ^(pass argument column) {action body};
23. Common open source frameworks
Network framework: ASIHttpRequest, AFNetworking, coocaHttpServer, etc.
Progress bar: SVprogressHUD MBprogressHUD,
Tools: SSToolKit, etc.
Sharing classes: ShareKit, etc
Logging frameworks: Log4j, Cocoa lumberJack, etc.
And so on.
24. Distinction between notification messages and brokers
Notification: includes local and remote notification. The recipient of the notice is required to register the change of notice. This notification will be accepted by registered recipients after it is sent by NSNotificationCenter. The remote notification needs to use the Apple server to transfer the notification.
Proxying: Delegating what one object does to another object.
Differences between the two:
Delegate for the one-to-one relationship, used for the sender to receive a function feedback from reciever.
Notification For one-to-one/many/ None,reciver, used to notify multiple Objects of an event, sender is only responsible for sending the Notification.
25. Data parsing (JSON and XML)
Json data parsing usually relies on some open source frameworks, such as SBJson, TouchJson,jsonKit, and the native JSON parsing NSJSON Serialization provided by Apple. Remove json data and convert it to dictionaries that are commonly used in IOS.
Parsing XML data. XML is divided into SAX and DOM parsing methods.
When DOM parses XML, it reads the entire XML document and builds a memory-resident tree structure (node tree) that can be traversed to retrieve any XML node and read its attributes and values. And typically, XML nodes can be queried directly with XPath.
SAX parsing XML, is based on the event notification mode, while reading XML documents while processing, do not have to wait for the entire document load to take action, when in the process of reading and parsing encountered objects to be processed, will send a notice for its processing.
On the iOS platform, XML parsing libraries are commonly used as follows:
NSXMLParser, a library that parses XML in SAX, is included by default in the iOS SDK and is relatively easy to use.
Libxml2, an open source class library that is included by default in the iOS SDK, is based on a C-language API, so it may not be as easy to use as NSXML. This library supports both DOM and SAX parsing. Libxml2’s SAX parsing is cool because it can be read and parsed at the same time, especially when you download a large XML file from the Web.
TBXML, a lightweight DOM style XML parsing class library, has good performance and low memory footprint, but it does not validate XML, does not support XPath, and only supports parsing, not modifying XML.
TouchXML, a DOM style XML parsing library, supports XPath and does not support XML modification.
KissXML, a set of XML parsing libraries based on TouchXML, supports XML modification compared to TouchXML.
TinyXML is a small class library for XML parsing based on THE DOM of C language. It supports reading and modifying XML. It does not support XPath directly, but requires another related class library TinyXPath to support XPath.
GDataXML, which is a set of Google developed DOM XML parsing class library, support to read and modify XML documents, support XPath query.
26.webservice
Web Services are platform-independent, loosely-coupled, self-contained, programmable Web-based applications that can be described, published, discovered, coordinated, and configured using open XML standards to develop distributed, interoperable applications. Technical support includes:
XML 1.1 and XSD
1.2 the Soap
WSDL 1.3
1.4 the uddi
1.5 Invoking RPC and Messaging
27. Steps of App development, developer account, and App release to appstore
There are two types of certificates: developer certificate and publisher certificate. The former is used for development and the latter for release
(1) No code signature is required for simulator debugging; Real machine debugging requires developer certificate code signature; The certificate signature must be published
(2) Code signature needs: certificate + private key,
(3) During commissioning, a provision profile must be installed on the device, which contains the following information:
Authorized debugging device list, application ID. Each application corresponds to a description file.
28. Class Inheritance, Class extension, category
You can add new methods to a category without knowing or changing the original code. You can only add, not delete.
And if there is a name conflict between a category and a method in the original class, the category overrides the original method because the category has higher precedence.
The main categories are
Three functions:
(1) Split the implementation of the class into multiple different files or multiple different frameworks.
(2) Create forward references to private methods.
(3) Add informal protocols to objects.
Inheritance can add, modify, or delete methods, and can add attributes.
The difference between categories and extensions is that the latter can add attributes. In addition, the latter method must be implemented.
Extensions can be considered private
The Category.
29. CAlayer is introduced
A UIView contains a CALayer tree, which is a data model. Contains objects used for display. A layer component can be found in any UIView subclass. A layer is a subpiece on a fixed canvas that can be overwritten. Layers are stacked on top of each other to produce an interface. This layer can contain multiple layers through which you can manipulate other content above the layer, such as rotation, animation, page turning, etc.
30. How does ios implement multiple inheritance
IOS implements multiple inheritance by implementing protocol delegate agent and realizing multiple interfaces.
31. App performance test method
Test CPU and Mermory performance using tools provided by Xcode such as Instrument. Open source automated testing tools are also available: Frank, KIF, etc.
32. How can NSArray put primitive data types (int, float, nil) into a structure
NSArray can only store objective-C object data models, and these basic data types need to be converted to NSNumber objects before they can be stored in arrays.
33. Mix objective-C with C and C ++
In Objective-C++, methods can be called either from C++ code or from Objective-C. In both languages objects are Pointers and can be used anywhere. For example, C++ classes can use Pointers to Objective-C objects as data members, and Objective-C classes can have C++ object Pointers as instance variables. Xcode requires the source file to have the extension “.mm” in order to launch the objective-C ++ extension to the compiler.
34. Common language encodings (UTF-8, Unicode, GB2312, GBK)
Common language encodings are:
GB2312: Simplified Chinese encoding, a Chinese character takes up 2 bytes, is the main encoding mode in mainland China.
BIG5: Traditional Chinese encoding. It is mainly used in Taiwan.
GBK: Supports simplified and traditional Chinese, but has problems with other non-Latin alphabet languages.
Utf-8: A type of Unicode encoding. Unicode encodings three sets of basic reserved characters, utF-8,UTF-16, and UTF-32. In UTF-8, characters are encoded in 8-bit sequences, with one or more bytes representing a character. The biggest advantage of this approach is that UTF-8 retains the ASCII character encoding as part of it. Utf-8, commonly known as “universal code”, can display multiple languages on the same screen. One Chinese character takes up 3 bytes. For internationalization, web pages should be encoded in UTF-8 whenever possible.
Of course, when processing Chinese HTTP header should also be changed to utF-8 encoding —– plus.
Official name of a language character set
English, Western European ASCII, ISO-8859-1 MBCS multi-byte
Simplified Chinese GB2312 MBCS multi-byte
BIG5 MBCS multi-byte
Simple Chinese GBK MBCS multi-byte
Chinese, Japanese and Korean GB18030 MBCS multi-byte
National languages UNICODE, UCS DBCS wide bytes
35. Common encryption and decryption methods (RSA, AES, MD5)
Common encryption and decryption methods are:
RSA: Non-object encryption algorithm based on public and private keys. Wide range of application.
AES: is a popular way to encrypt objects. Encryption involves matrix operations.
MD5: converts an arbitrary “byte string” into a 128bit large integer, and it is an irreversible string conversion algorithm.
36. Advantages and disadvantages of Objective-C
Objc advantages:
-
Cateogies
-
Posing
-
Dynamic identification
-
Index calculation
5) Flexible messaging
-
Not an overly complex C derivative language
-
Objective-c and C++ can be mixed programming
Disadvantages:
-
Namespaces are not supported
-
Operator overloading is not supported
3) Multiple inheritance is not supported
4) With dynamic runtime types, all methods are function calls, so many compile-time optimization methods are not used. (such as inline functions), poor performance.
37. Debugging tips for ios apps
1. In the event of a crash, analyze the crash log (for which the Symbolicatedrash tool works) and keep the.dsym file of the crashed version
2. Go to the breakpoint management window in XCode. Then click the + in the lower right to add a new Exception Breakpoint.
3. If EXC_BAD_ACCESS is encountered, turn on the Scheme option and select EditScheme. Then check Enable Zombie Objects and Malloc Stack.
4. Effective log management. NSLog and adding some open source log management frameworks.
5. Program breakpoint debug mode.
38, application performance tuning (http://www.open-open.com/lib/view/open1365861753734.html)
-
Use ARC to Manage Memory
2. Use a reuseIdentifier Where Appropriate
3. Set View as Opaque When Possible
4. Avoid Fat XIBs files
5. Don’t Block the Main Thread
6. Adjust the Size of Images to Image Views
7. Choose the Correct Collection
8. Enable Gzip Compression (Enable Gzip Compression)
- Reuse and Lazy Load Views
Cache,Cache,Cache (Cache,Cache,Cache)
11. Consider Drawing
12. Handle Memory Warnings
Reuse Expensive Objects
14. Use Sprite Sheets
15. Avoid re-processing Data.
16. Choose the Right Data Format
17. Set Background Images Appropriately
18. Reduce Your Web Footprint
19. Set the Shadow Path.
Optimize Your Table Views)
21. Choose Correct Data Storage Option
22. Speed up Launch Time
23. Use AutoRelease Pool
24. Cache Images-Or not
25. Avoid Date Formatters Where Possible
39. Differences between UIScrollView’s contentSize, contentOffSet and contentInset properties
ContentSize Indicates the size of the UIScrollView scroll area. The frame property of a UIScrollView does not change with the content once it is set.
ContentOffSet represents the offset of the vertices in the current display area of UIScrollView relative to the frame vertices and is used to set the location of the UIScrollView display.
ContentInset is the position of the vertex of the contentView relative to the ScrollView, so let’s say your contentInset is equal to (0,100), So your contentView is going to start at (0,100) of the ScrollView. It’s always (0,0) from the beginning of the scrollView.
40.IOS6 AutoLayout
AutoLayout is the automatic layout feature introduced after IOS6, some types have android relative layout properties. Check AutoLayout to set various constraints for automatic layout on different devices and in different directions. Autosizing Mask is the springs and Struts model. Autosizing Mask determines what happens to a view when its superView changes size. Autolayout can not only set the changes made by the superView when it changes, but also supports the changes made by the neighboring views when they change.
41. If you have a string aabcad, write a program to remove the non-contiguous duplicate strings in the string, that is, the output after the string processing is aabcd
NSMutableString * str1 = [[NSMutableString alloc] initWithFormat:@”aabcad”];
for (int i = 0; i < str1.length – 1; i++)
{ for (int j = i + 1; j < str1.length ; j++)
{// Unsigined modification is needed because the character string isEqualToString can only be converted to ASCII value for comparison
unsigned char a = [str1 characterAtIndex:i];
unsigned char b = [str1 characterAtIndex:j];
if (a == b)
{ if (j – i > 1)
{
// NSRange: truncate string {j, 1} j: start with the first character 1: truncate several characters
NSRange range = {j, 1};
[str1 deleteCharactersInRange:range];
j = i–;
}
}
}
} NSLog(@”—— %@——-“, str1);
In this paper, for the third party transfer, the original link: blog.csdn.net/u010500895/…
If the article is not correct, welcome criticism, a small and useful QQ communication group: 805558511