objc2_ui_kit/generated/
UIImageView.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9#[cfg(feature = "objc2-quartz-core")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_quartz_core::*;
12#[cfg(feature = "objc2-symbols")]
13use objc2_symbols::*;
14
15use crate::*;
16
17extern_class!(
18    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiimageview?language=objc)
19    #[unsafe(super(UIView, UIResponder, NSObject))]
20    #[thread_kind = MainThreadOnly]
21    #[derive(Debug, PartialEq, Eq, Hash)]
22    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
23    pub struct UIImageView;
24);
25
26#[cfg(all(
27    feature = "UIResponder",
28    feature = "UIView",
29    feature = "objc2-quartz-core"
30))]
31#[cfg(not(target_os = "watchos"))]
32extern_conformance!(
33    unsafe impl CALayerDelegate for UIImageView {}
34);
35
36#[cfg(all(feature = "UIResponder", feature = "UIView"))]
37extern_conformance!(
38    unsafe impl NSCoding for UIImageView {}
39);
40
41#[cfg(all(feature = "UIResponder", feature = "UIView"))]
42extern_conformance!(
43    unsafe impl NSObjectProtocol for UIImageView {}
44);
45
46#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
47extern_conformance!(
48    unsafe impl UIAppearance for UIImageView {}
49);
50
51#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
52extern_conformance!(
53    unsafe impl UIAppearanceContainer for UIImageView {}
54);
55
56#[cfg(all(feature = "UIResponder", feature = "UIView"))]
57extern_conformance!(
58    unsafe impl UICoordinateSpace for UIImageView {}
59);
60
61#[cfg(all(
62    feature = "UIDynamicBehavior",
63    feature = "UIResponder",
64    feature = "UIView"
65))]
66extern_conformance!(
67    unsafe impl UIDynamicItem for UIImageView {}
68);
69
70#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
71extern_conformance!(
72    unsafe impl UIFocusEnvironment for UIImageView {}
73);
74
75#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
76extern_conformance!(
77    unsafe impl UIFocusItem for UIImageView {}
78);
79
80#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
81extern_conformance!(
82    unsafe impl UIFocusItemContainer for UIImageView {}
83);
84
85#[cfg(all(feature = "UIResponder", feature = "UIView"))]
86extern_conformance!(
87    unsafe impl UIResponderStandardEditActions for UIImageView {}
88);
89
90#[cfg(all(
91    feature = "UIResponder",
92    feature = "UITraitCollection",
93    feature = "UIView"
94))]
95extern_conformance!(
96    unsafe impl UITraitEnvironment for UIImageView {}
97);
98
99#[cfg(all(feature = "UIResponder", feature = "UIView"))]
100impl UIImageView {
101    extern_methods!(
102        #[cfg(feature = "UIImage")]
103        #[unsafe(method(initWithImage:))]
104        #[unsafe(method_family = init)]
105        pub unsafe fn initWithImage(
106            this: Allocated<Self>,
107            image: Option<&UIImage>,
108        ) -> Retained<Self>;
109
110        #[cfg(feature = "UIImage")]
111        #[unsafe(method(initWithImage:highlightedImage:))]
112        #[unsafe(method_family = init)]
113        pub unsafe fn initWithImage_highlightedImage(
114            this: Allocated<Self>,
115            image: Option<&UIImage>,
116            highlighted_image: Option<&UIImage>,
117        ) -> Retained<Self>;
118
119        #[cfg(feature = "UIImage")]
120        #[unsafe(method(image))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn image(&self) -> Option<Retained<UIImage>>;
123
124        #[cfg(feature = "UIImage")]
125        /// Setter for [`image`][Self::image].
126        #[unsafe(method(setImage:))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn setImage(&self, image: Option<&UIImage>);
129
130        #[cfg(feature = "UIImage")]
131        #[unsafe(method(highlightedImage))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn highlightedImage(&self) -> Option<Retained<UIImage>>;
134
135        #[cfg(feature = "UIImage")]
136        /// Setter for [`highlightedImage`][Self::highlightedImage].
137        #[unsafe(method(setHighlightedImage:))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn setHighlightedImage(&self, highlighted_image: Option<&UIImage>);
140
141        #[cfg(all(
142            feature = "UIImageConfiguration",
143            feature = "UIImageSymbolConfiguration"
144        ))]
145        #[unsafe(method(preferredSymbolConfiguration))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn preferredSymbolConfiguration(
148            &self,
149        ) -> Option<Retained<UIImageSymbolConfiguration>>;
150
151        #[cfg(all(
152            feature = "UIImageConfiguration",
153            feature = "UIImageSymbolConfiguration"
154        ))]
155        /// Setter for [`preferredSymbolConfiguration`][Self::preferredSymbolConfiguration].
156        #[unsafe(method(setPreferredSymbolConfiguration:))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn setPreferredSymbolConfiguration(
159            &self,
160            preferred_symbol_configuration: Option<&UIImageSymbolConfiguration>,
161        );
162
163        #[unsafe(method(isUserInteractionEnabled))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn isUserInteractionEnabled(&self) -> bool;
166
167        /// Setter for [`isUserInteractionEnabled`][Self::isUserInteractionEnabled].
168        #[unsafe(method(setUserInteractionEnabled:))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn setUserInteractionEnabled(&self, user_interaction_enabled: bool);
171
172        #[unsafe(method(isHighlighted))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn isHighlighted(&self) -> bool;
175
176        /// Setter for [`isHighlighted`][Self::isHighlighted].
177        #[unsafe(method(setHighlighted:))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn setHighlighted(&self, highlighted: bool);
180
181        #[cfg(feature = "UIImage")]
182        #[unsafe(method(animationImages))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn animationImages(&self) -> Option<Retained<NSArray<UIImage>>>;
185
186        #[cfg(feature = "UIImage")]
187        /// Setter for [`animationImages`][Self::animationImages].
188        #[unsafe(method(setAnimationImages:))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn setAnimationImages(&self, animation_images: Option<&NSArray<UIImage>>);
191
192        #[cfg(feature = "UIImage")]
193        #[unsafe(method(highlightedAnimationImages))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn highlightedAnimationImages(&self) -> Option<Retained<NSArray<UIImage>>>;
196
197        #[cfg(feature = "UIImage")]
198        /// Setter for [`highlightedAnimationImages`][Self::highlightedAnimationImages].
199        #[unsafe(method(setHighlightedAnimationImages:))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn setHighlightedAnimationImages(
202            &self,
203            highlighted_animation_images: Option<&NSArray<UIImage>>,
204        );
205
206        #[unsafe(method(animationDuration))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn animationDuration(&self) -> NSTimeInterval;
209
210        /// Setter for [`animationDuration`][Self::animationDuration].
211        #[unsafe(method(setAnimationDuration:))]
212        #[unsafe(method_family = none)]
213        pub unsafe fn setAnimationDuration(&self, animation_duration: NSTimeInterval);
214
215        #[unsafe(method(animationRepeatCount))]
216        #[unsafe(method_family = none)]
217        pub unsafe fn animationRepeatCount(&self) -> NSInteger;
218
219        /// Setter for [`animationRepeatCount`][Self::animationRepeatCount].
220        #[unsafe(method(setAnimationRepeatCount:))]
221        #[unsafe(method_family = none)]
222        pub unsafe fn setAnimationRepeatCount(&self, animation_repeat_count: NSInteger);
223
224        #[cfg(feature = "UIColor")]
225        #[unsafe(method(tintColor))]
226        #[unsafe(method_family = none)]
227        pub unsafe fn tintColor(&self) -> Option<Retained<UIColor>>;
228
229        #[cfg(feature = "UIColor")]
230        /// Setter for [`tintColor`][Self::tintColor].
231        #[unsafe(method(setTintColor:))]
232        #[unsafe(method_family = none)]
233        pub unsafe fn setTintColor(&self, tint_color: Option<&UIColor>);
234
235        #[unsafe(method(startAnimating))]
236        #[unsafe(method_family = none)]
237        pub unsafe fn startAnimating(&self);
238
239        #[unsafe(method(stopAnimating))]
240        #[unsafe(method_family = none)]
241        pub unsafe fn stopAnimating(&self);
242
243        #[unsafe(method(isAnimating))]
244        #[unsafe(method_family = none)]
245        pub unsafe fn isAnimating(&self) -> bool;
246
247        #[cfg(feature = "UIInterface")]
248        /// The preferred treatment to use for HDR images. By default the image view will defer to the value from its traitCollection.
249        #[unsafe(method(preferredImageDynamicRange))]
250        #[unsafe(method_family = none)]
251        pub unsafe fn preferredImageDynamicRange(&self) -> UIImageDynamicRange;
252
253        #[cfg(feature = "UIInterface")]
254        /// Setter for [`preferredImageDynamicRange`][Self::preferredImageDynamicRange].
255        #[unsafe(method(setPreferredImageDynamicRange:))]
256        #[unsafe(method_family = none)]
257        pub unsafe fn setPreferredImageDynamicRange(
258            &self,
259            preferred_image_dynamic_range: UIImageDynamicRange,
260        );
261
262        #[cfg(feature = "UIInterface")]
263        /// The resolved treatment to use for HDR images.
264        #[unsafe(method(imageDynamicRange))]
265        #[unsafe(method_family = none)]
266        pub unsafe fn imageDynamicRange(&self) -> UIImageDynamicRange;
267
268        #[unsafe(method(adjustsImageWhenAncestorFocused))]
269        #[unsafe(method_family = none)]
270        pub unsafe fn adjustsImageWhenAncestorFocused(&self) -> bool;
271
272        /// Setter for [`adjustsImageWhenAncestorFocused`][Self::adjustsImageWhenAncestorFocused].
273        #[unsafe(method(setAdjustsImageWhenAncestorFocused:))]
274        #[unsafe(method_family = none)]
275        pub unsafe fn setAdjustsImageWhenAncestorFocused(
276            &self,
277            adjusts_image_when_ancestor_focused: bool,
278        );
279
280        #[cfg(feature = "UILayoutGuide")]
281        #[unsafe(method(focusedFrameGuide))]
282        #[unsafe(method_family = none)]
283        pub unsafe fn focusedFrameGuide(&self) -> Retained<UILayoutGuide>;
284
285        #[unsafe(method(overlayContentView))]
286        #[unsafe(method_family = none)]
287        pub unsafe fn overlayContentView(&self) -> Retained<UIView>;
288
289        #[unsafe(method(masksFocusEffectToContents))]
290        #[unsafe(method_family = none)]
291        pub unsafe fn masksFocusEffectToContents(&self) -> bool;
292
293        /// Setter for [`masksFocusEffectToContents`][Self::masksFocusEffectToContents].
294        #[unsafe(method(setMasksFocusEffectToContents:))]
295        #[unsafe(method_family = none)]
296        pub unsafe fn setMasksFocusEffectToContents(&self, masks_focus_effect_to_contents: bool);
297    );
298}
299
300/// Methods declared on superclass `UIView`.
301#[cfg(all(feature = "UIResponder", feature = "UIView"))]
302impl UIImageView {
303    extern_methods!(
304        #[cfg(feature = "objc2-core-foundation")]
305        #[unsafe(method(initWithFrame:))]
306        #[unsafe(method_family = init)]
307        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
308
309        #[unsafe(method(initWithCoder:))]
310        #[unsafe(method_family = init)]
311        pub unsafe fn initWithCoder(
312            this: Allocated<Self>,
313            coder: &NSCoder,
314        ) -> Option<Retained<Self>>;
315    );
316}
317
318/// Methods declared on superclass `NSObject`.
319#[cfg(all(feature = "UIResponder", feature = "UIView"))]
320impl UIImageView {
321    extern_methods!(
322        #[unsafe(method(init))]
323        #[unsafe(method_family = init)]
324        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
325
326        #[unsafe(method(new))]
327        #[unsafe(method_family = new)]
328        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
329    );
330}
331
332#[cfg(all(feature = "UIResponder", feature = "UIView"))]
333impl UIImageView {
334    extern_methods!(
335        #[cfg(feature = "objc2-symbols")]
336        /// Adds a symbol effect to the image view with default options and animation.
337        #[unsafe(method(addSymbolEffect:))]
338        #[unsafe(method_family = none)]
339        pub unsafe fn addSymbolEffect(&self, symbol_effect: &NSSymbolEffect);
340
341        #[cfg(feature = "objc2-symbols")]
342        /// Adds a symbol effect to the image view with specified options and default animation.
343        #[unsafe(method(addSymbolEffect:options:))]
344        #[unsafe(method_family = none)]
345        pub unsafe fn addSymbolEffect_options(
346            &self,
347            symbol_effect: &NSSymbolEffect,
348            options: &NSSymbolEffectOptions,
349        );
350
351        #[cfg(feature = "objc2-symbols")]
352        /// Adds a symbol effect to the image view with specified options and animation.
353        #[unsafe(method(addSymbolEffect:options:animated:))]
354        #[unsafe(method_family = none)]
355        pub unsafe fn addSymbolEffect_options_animated(
356            &self,
357            symbol_effect: &NSSymbolEffect,
358            options: &NSSymbolEffectOptions,
359            animated: bool,
360        );
361
362        #[cfg(all(
363            feature = "UISymbolEffectCompletion",
364            feature = "block2",
365            feature = "objc2-symbols"
366        ))]
367        /// Adds a symbol effect to the image view with specified options, animation, and completion handler.
368        #[unsafe(method(addSymbolEffect:options:animated:completion:))]
369        #[unsafe(method_family = none)]
370        pub unsafe fn addSymbolEffect_options_animated_completion(
371            &self,
372            symbol_effect: &NSSymbolEffect,
373            options: &NSSymbolEffectOptions,
374            animated: bool,
375            completion_handler: UISymbolEffectCompletion,
376        );
377
378        #[cfg(feature = "objc2-symbols")]
379        /// Removes from the image view the symbol effect matching the type of effect passed in, with default options and animation.
380        #[unsafe(method(removeSymbolEffectOfType:))]
381        #[unsafe(method_family = none)]
382        pub unsafe fn removeSymbolEffectOfType(&self, symbol_effect: &NSSymbolEffect);
383
384        #[cfg(feature = "objc2-symbols")]
385        /// Removes from the image view the symbol effect matching the type of effect passed in, with specified options and default animation.
386        #[unsafe(method(removeSymbolEffectOfType:options:))]
387        #[unsafe(method_family = none)]
388        pub unsafe fn removeSymbolEffectOfType_options(
389            &self,
390            symbol_effect: &NSSymbolEffect,
391            options: &NSSymbolEffectOptions,
392        );
393
394        #[cfg(feature = "objc2-symbols")]
395        /// Removes from the image view the symbol effect matching the type of effect passed in, with specified options and animation.
396        #[unsafe(method(removeSymbolEffectOfType:options:animated:))]
397        #[unsafe(method_family = none)]
398        pub unsafe fn removeSymbolEffectOfType_options_animated(
399            &self,
400            symbol_effect: &NSSymbolEffect,
401            options: &NSSymbolEffectOptions,
402            animated: bool,
403        );
404
405        #[cfg(all(
406            feature = "UISymbolEffectCompletion",
407            feature = "block2",
408            feature = "objc2-symbols"
409        ))]
410        /// Removes from the image view the symbol effect matching the type of effect passed in, with specified options, animation, and completion handler.
411        #[unsafe(method(removeSymbolEffectOfType:options:animated:completion:))]
412        #[unsafe(method_family = none)]
413        pub unsafe fn removeSymbolEffectOfType_options_animated_completion(
414            &self,
415            symbol_effect: &NSSymbolEffect,
416            options: &NSSymbolEffectOptions,
417            animated: bool,
418            completion_handler: UISymbolEffectCompletion,
419        );
420
421        /// Removes all symbol effects from the image view with default options and animation.
422        #[unsafe(method(removeAllSymbolEffects))]
423        #[unsafe(method_family = none)]
424        pub unsafe fn removeAllSymbolEffects(&self);
425
426        #[cfg(feature = "objc2-symbols")]
427        /// Removes all symbol effects from the image view with specified options and default animation.
428        #[unsafe(method(removeAllSymbolEffectsWithOptions:))]
429        #[unsafe(method_family = none)]
430        pub unsafe fn removeAllSymbolEffectsWithOptions(&self, options: &NSSymbolEffectOptions);
431
432        #[cfg(feature = "objc2-symbols")]
433        /// Removes all symbol effects from the image view with specified options and animation.
434        #[unsafe(method(removeAllSymbolEffectsWithOptions:animated:))]
435        #[unsafe(method_family = none)]
436        pub unsafe fn removeAllSymbolEffectsWithOptions_animated(
437            &self,
438            options: &NSSymbolEffectOptions,
439            animated: bool,
440        );
441
442        #[cfg(all(feature = "UIImage", feature = "objc2-symbols"))]
443        /// Sets the symbol image on the image view with a symbol content transition and default options.
444        /// Passing in a non-symbol image will result in undefined behavior.
445        #[unsafe(method(setSymbolImage:withContentTransition:))]
446        #[unsafe(method_family = none)]
447        pub unsafe fn setSymbolImage_withContentTransition(
448            &self,
449            symbol_image: &UIImage,
450            transition: &NSSymbolContentTransition,
451        );
452
453        #[cfg(all(feature = "UIImage", feature = "objc2-symbols"))]
454        /// Sets the symbol image on the image view with a symbol content transition and specified options.
455        /// Passing in a non-symbol image will result in undefined behavior.
456        #[unsafe(method(setSymbolImage:withContentTransition:options:))]
457        #[unsafe(method_family = none)]
458        pub unsafe fn setSymbolImage_withContentTransition_options(
459            &self,
460            symbol_image: &UIImage,
461            transition: &NSSymbolContentTransition,
462            options: &NSSymbolEffectOptions,
463        );
464
465        #[cfg(all(
466            feature = "UIImage",
467            feature = "UISymbolEffectCompletion",
468            feature = "block2",
469            feature = "objc2-symbols"
470        ))]
471        /// Sets the symbol image on the image view with a symbol content transition, options, and completion handler.
472        /// Passing in a non-symbol image will result in undefined behavior.
473        #[unsafe(method(setSymbolImage:withContentTransition:options:completion:))]
474        #[unsafe(method_family = none)]
475        pub unsafe fn setSymbolImage_withContentTransition_options_completion(
476            &self,
477            symbol_image: &UIImage,
478            transition: &NSSymbolContentTransition,
479            options: &NSSymbolEffectOptions,
480            completion_handler: UISymbolEffectCompletion,
481        );
482    );
483}