Home Backend Development PHP Tutorial iOS development questions (11)

iOS development questions (11)

Jan 20, 2017 am 09:54 AM

131. How to restrict ScrollView from scrolling in a certain direction?
For example, to restrict scrolling in the x direction, you can implement the UIScrollViewDelegate protocol method:

func scrollViewDidScroll(scrollView: UIScrollView) {
ifabs(scrollView.contentOffset.x) > 0 {
scrollView.contentOffset= CGPointMake(0, scrollView.contentOffset.y)
}
}
Copy after login

132. How to import the O-C framework into the Swift Framework target
Take BmobSDK as an example (CommonCrypto, etc. C/O-C framework is the same), when you add BmobSDK to Link Binary With Libraries, when you use the "importBmobSDK" statement, an error occurs: no such module
If you try to import BmobSDK using bridging headers, then will cause another error.
This is because Swift Framework does not support bridging headers files.
To solve this problem, you need to go through the following steps:
1) Create the BmobSDK directory in the project directory and place BmobSDK.framework in this directory. At the same time, create a module.map file in this directory with the following content:

module BmobSDK [system] {
header"/Users/kmyhy/Documents/Swift/code/第12章/kNote/BmobSDK/BmobSDK.framework/Headers/Bmob.h"
link "BmobSDK"
export *
}
Copy after login

This will allow us to use BmobSDK as a Swift module.
2) In Build Settings, find Import Paths (SWIFT_INCLUDE_PATHS) and add the BmobSDK directory. As shown in the figure below:

3) Import the BmobSDK framework in the swift file:
import BmobSDK

133. How to use CocoaPods in App Extension
Add this sentence in the Podfile :
link_with 'Extended name'
Add the bridging header file and set the Objective-C BridgingHeader.
134, error 'xxx.pch' has been modified since the precompiled header was builterror in Xcode
Execute deep Clean (shortcut key Option+Command+Shift+K)

135, Document Provider extension , the documentStorageURL property of DocumentPickerViewController returns nil.
Confirm that the App Groups of the container App, Document Provider extension and File Provider extension are set correctly. If there are any exclamation marks, please Fix them.
136. Inserting and deleting Cells in CollectionView
Same as TableView, we can use insertItemsAtIndexPaths()/deleteItemsAtIndexPaths() to insert/delete cells. The difference is that CollectionView no longer supports the beginUpdates()/endUpdates() operations. Insertion/deletion animation is supported by default. If you do not want the default animation effect, you can set the animationsEnabled property of UIView:

BOOL animationsEnabled = [UIView areAnimationsEnabled];
[UIView setAnimationsEnabled:NO];
[myCollectionView reloadItemsAtIndexPaths:myIndexPaths];
[UIView setAnimationsEnabled:animationsEnabled];
Copy after login

137. UICollectionView in UIScrollView will not scroll
Check whether UIScrollView is set delegate property, and check whether the scrollViewDidScroll method is implemented in delegate. If so, please delete the method (just canceling the delegate attribute will not work).
Also check the width (or width constraint), height (or height constraint), and list content size of UICollectionView, because when the list content is smaller than the width (or height) of UICollectionView, the scroll bar in this direction will not appear.
138. Why does the cell display incorrectly when it uses UITableViewCellStyleValue1?
UITableViewCell has several built-in types, such as UITableViewCellStyleDefault, UITableViewCellStyleValue1, and UITableViewCellStyleValue2.
These Cells are pre-configured by the SDK, and they present fixed built-in styles, such as font size, color, alignment, etc. If you want to modify these configurations, it is likely that the display is abnormal. For example, some text can be displayed for a while, and then not displayed, or the inherent font (and color) is displayed for a while, and then (for example, clicking a cell) is displayed again. Display the modified font (and color).
In this case, you're better off customizing your own cell (subclassing).
139. The size calculated by boundingRectWithSize is incorrect?
Pay attention to providing the correct options parameters. For UILabel, you need to use at least two options: UsesLineFragmentOrigin and UsesFontLeading:

CGRect paragraphRect =
[attributedTextboundingRectWithSize:CGSizeMake(300.f, CGFLOAT_MAX)
options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading)
context:nil];
Copy after login

140. Bitwise OR (|) operation cannot be performed on multiple enumeration values ​​in Swift
Note that this problem is Fixed in iOS 8.3 SDK Beta 1 (12F5027d). For SDKs lower than this version, we can use the following code instead:

let options =unsafeBitCast(NSStringDrawingOptions.UsesLineFragmentOrigin.rawValue |
NSStringDrawingOptions.UsesFontLeading.rawValue,
NSStringDrawingOptions.self)
let frame = text.boundingRectWithSize(size, options:options, attributes:D,context:nil)
Copy after login

The above is the content of iOS Development Questions (11). For more related content, please pay attention to the PHP Chinese website (www.php .cn)!


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1666
14
PHP Tutorial
1273
29
C# Tutorial
1252
24
The first version of Apple's iOS 18 was exposed to have so many bugs: serious fever, WeChat delay The first version of Apple's iOS 18 was exposed to have so many bugs: serious fever, WeChat delay Jun 13, 2024 pm 09:39 PM

The annual WWDC has ended, and iOS18 is undoubtedly the focus of everyone's attention. Currently, many iPhone users are rushing to upgrade to iOS18, but various system bugs are making people uncomfortable. Some bloggers said that you should be cautious when upgrading to iOS18 because "there are so many bugs." The blogger said that if your iPhone is your main machine, it is recommended not to upgrade to iOS18 because the first version has many bugs. He also summarized several system bugs currently encountered: 1. Switching icon style is stuck, causing the icon not to be displayed. 2. Flashlight width animation is often lost. 3. Douyin App cannot upload videos. 4. WeChat message push is delayed by about 10 seconds. 5 . Occasionally, the phone cannot be made and the screen is black. 6. Severe fever.

Apple re-releases iOS/iPadOS 18 Beta 4 update, version number raised to 22A5316k Apple re-releases iOS/iPadOS 18 Beta 4 update, version number raised to 22A5316k Jul 27, 2024 am 11:06 AM

Thanks to netizens Ji Yinkesi, xxx_x, fried tomatoes, Terrence, and spicy chicken drumsticks for submitting clues! According to news on July 27, Apple today re-released the iOS/iPadOS 18 Beta 4 update for developers. The internal version number was upgraded from 22A5316j to 22A5316k. It is currently unclear the difference between the two Beta 4 version updates. Registered developers can open the "Settings" app, enter the "Software Update" section, click the "Beta Update" option, and then toggle the iOS18/iPadOS18 Developer Beta settings to select the beta version. Downloading and installing the beta version requires an Apple ID associated with a developer account. Reported on July 24, iO

Update | Hacker explains how to install Epic Games Store and Fortnite on iPad outside the EU Update | Hacker explains how to install Epic Games Store and Fortnite on iPad outside the EU Aug 18, 2024 am 06:34 AM

Update: Saunders Tech has uploaded a tutorial to his YouTube channel (video embedded below) explaining how to install Fortnite and the Epic Games Store on an iPad outside the EU. However, not only does the process require specific beta versions of iO

Apple releases open source Swift package for homomorphic encryption, deployed in iOS 18 Apple releases open source Swift package for homomorphic encryption, deployed in iOS 18 Jul 31, 2024 pm 01:10 PM

According to news on July 31, Apple issued a press release yesterday (July 30), announcing the launch of a new open source Swift package (swift-homomorphic-encryption) for enabling homomorphic encryption in the Swift programming language. Note: Homomorphic Encryption (HE) refers to an encryption algorithm that satisfies the homomorphic operation properties of ciphertext. That is, after the data is homomorphically encrypted, specific calculations are performed on the ciphertext, and the obtained ciphertext calculation results are processed at the same time. The plaintext after state decryption is equivalent to directly performing the same calculation on the plaintext data, achieving the "invisibility" of the data. Homomorphic encryption technology can calculate encrypted data without leaking the underlying unencrypted data to the operation process.

New features of Apple's iOS 18 'Boundless Notes” app: expanded Scenes functionality, introduced grid alignment New features of Apple's iOS 18 'Boundless Notes” app: expanded Scenes functionality, introduced grid alignment Jun 02, 2024 pm 05:05 PM

According to news on June 1, technology media AppleInsider published a blog post today, stating that Apple will launch a new navigation function of "Scenes" for the "Freeform" application extension in the iOS18 system, and add new options for object alignment. Introduction to the "Wubianji" application First, let's briefly introduce the "Wubianji" application. The application will be launched in 2022 and has currently launched iOS, iPadOS, macOS15 and visionOS versions. Apple’s official introduction is as follows: “Boundless Notes” is an excellent tool for turning inspiration into reality. Sketch projects, design mood boards, or start brainstorming on a flexible canvas that supports nearly any file type. With iCloud, all your boards

Apple iOS/iPadOS 18 Developer Preview Beta 4 released: Added CarPlay wallpapers, sorted out settings options, enhanced camera control Apple iOS/iPadOS 18 Developer Preview Beta 4 released: Added CarPlay wallpapers, sorted out settings options, enhanced camera control Jul 24, 2024 am 09:54 AM

Thanks to netizens Spicy Chicken Leg Burger, Soft Media New Friends 2092483, Handwritten Past, DingHao, Xiaoxing_14, Wowotou Eat Big Kou, Feiying Q, Soft Media New Friends 2168428, Slades, Aaron212, Happy Little Hedgehog, Little Earl, Clues for the little milk cat that eats fish! [Click here to go directly to the upgrade tutorial] According to news on July 24, Apple today pushed the iOS/iPadOS18 developer preview version Beta4 update (internal version number: 22A5316j) to iPhone and iPad users. This update is 15 days after the last release. . Carplay Wallpaper Apple has added wallpapers to CarPlay, covering light and dark modes. Its wallpaper style is similar to iPhone

Apple iOS 17.5 RC version released: allows EU iPhone users to download apps from the website Apple iOS 17.5 RC version released: allows EU iPhone users to download apps from the website May 08, 2024 am 09:30 AM

[Click here to go directly to the upgrade tutorial] According to news on May 8, Apple pushed the iOS17.5RC update (internal version number: 21F79) to iPhone users today. This update is 70 days away from the last release. How to upgrade iOS/iPadOS/watchOS/macOS development version and public beta version? To upgrade the iOS/iPadOS17 developer preview version and public beta version, you can refer to the experience shared by friends: Experience Post 1||Experience Post 2||Experience Post 3||Experience Post 4. Starting from the iOS/iPadOS 16.4 Developer Preview Beta 1, you need to register for the Apple Developer Program. After registration, open the system [Settings] [Software Update] to see the upgrade option. Please note that your iPhone or IP

Haqu K2 projector brings Olympic passion and dreams within reach Haqu K2 projector brings Olympic passion and dreams within reach Jul 24, 2024 pm 01:34 PM

In the just-concluded European Cup final, did you cheer crazily for the team you supported? In the upcoming Paris Olympics, are you also looking forward to perfectly capturing the highlight moments of each event? Among them, having a high-quality viewing equipment is crucial. The Haqu K2 projector is well-deserved to be a good choice for watching games due to its high cost performance and excellent performance. It not only has high brightness and clear picture quality, but also provides an immersive viewing experience, making every exciting moment of the game feel as if it is close at hand. Are you already attracted by such a device? It will definitely allow you to enjoy the passion and dreams of the Olympic Games at home. The most intimate highlight of Haqu K2 is its 210° super angle adjustment, which makes it convenient to watch movies whether on the ceiling or on the wall.

See all articles