Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improve section "Close the tip"#313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Tibimac wants to merge1 commit intosparrowcode:main
base:main
Choose a base branch
Loading
fromTibimac:patch-1
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletionsen/tutorials/tipkit.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -261,19 +261,28 @@ In the method, provide a reason why you closed the tip:
- `.displayCountExceeded` - the tip has been shown the maximum number of times
- `.tipClosed` - the user has clearly closed the tip

In UIKit, you need to add code for the cross. For `popover`-tip, close the controller:
In UIKit, you need to add code for the cross.
For `popover`-tip, close the controller:

```swift
if presentedViewController is TipUIPopoverViewController {
dismiss(animated: true)
if shouldDisplay {
...
} else {
if presentedViewController is TipUIPopoverViewController {
dismiss(animated: true)
}
}
```

For the `inline`-tip, we remove the view:

```swift
if let tipView = view.subviews.first(where: { $0 is TipUIView }) {
tipView.removeFromSuperview()
if shouldDisplay {
...
} else {
if let tipView = view.subviews.first(where: { $0 is TipUIView }) {
tipView.removeFromSuperview()
}
}
```

Expand Down
19 changes: 14 additions & 5 deletionsru/tutorials/tipkit.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -261,19 +261,28 @@ inlineTip.invalidate(reason: .actionPerformed)
- `.displayCountExceeded` - подсказку показали максимальное количество раз
- `.tipClosed` - пользователь явно закрыл подсказку

В UIKit для крестика нужно дописать код. Для `popover`-подсказки закрываем контроллер:
В UIKit для крестика нужно дописать код.
Для `popover`-подсказки закрываем контроллер:

```swift
if presentedViewController is TipUIPopoverViewController {
dismiss(animated: true)
if shouldDisplay {
...
} else {
if presentedViewController is TipUIPopoverViewController {
dismiss(animated: true)
}
}
```

Для `inline`-подсказки удаляем вью:

```swift
if let tipView = view.subviews.first(where: { $0 is TipUIView }) {
tipView.removeFromSuperview()
if shouldDisplay {
...
} else {
if let tipView = view.subviews.first(where: { $0 is TipUIView }) {
tipView.removeFromSuperview()
}
}
```

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp