-
Notifications
You must be signed in to change notification settings - Fork 42
/
UIAccelerometer.xml
359 lines (358 loc) · 22.3 KB
/
UIAccelerometer.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
<Type Name="UIAccelerometer" FullName="UIKit.UIAccelerometer">
<TypeSignature Language="C#" Value="public class UIAccelerometer : Foundation.NSObject" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit UIAccelerometer extends Foundation.NSObject" />
<TypeSignature Language="DocId" Value="T:UIKit.UIAccelerometer" />
<TypeSignature Language="F#" Value="type UIAccelerometer = class
 inherit NSObject" />
<AssemblyInfo>
<AssemblyName>Xamarin.iOS</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>Foundation.NSObject</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute>
<AttributeName>Foundation.Register("UIAccelerometer", true)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>ObjCRuntime.Deprecated(ObjCRuntime.PlatformName.iOS, 5, 0, ObjCRuntime.PlatformArchitecture.All, "Use 'CoreMotion' instead.")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.TvOS, ObjCRuntime.PlatformArchitecture.All, null)</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>A class that encapsulates the onboard hardware accelerometer and generates <see cref="T:UIKit.UIAcceleration" /> objects.</summary>
<remarks>
<para>The application developer must always use the <see cref="P:UIKit.UIAccelerometer.SharedAccelerometer" /> property to access the onboard accelerometer. Data in the form of <see cref="T:UIKit.UIAcceleration" /> objects can then be read via the <see cref="E:UIKit.UIAccelerometer.Acceleration" /> event, which will fire every <see cref="P:UIKit.UIAccelerometer.UpdateInterval" /> seconds.</para>
<para>In the following example, taken from the "GLPaintGameView" sample, the <see cref="P:UIKit.UIAccelerometer.UpdateInterval" /> is set to 1/25th of a second and the <c>OnAcceleration</c> method is assigned to handle acceleration events. In the handler, the <see cref="T:UIKit.UIAccelerometerEventArgs" /> parameter is used to determine the specifics of acceleration:</para>
<example>
<code lang="csharp lang-csharp"><![CDATA[
//Configure and enable the accelerometer
const int AccelerometerFrequency = 25;
UIAccelerometer.SharedAccelerometer.UpdateInterval = 1.0f / AccelerometerFrequency;
UIAccelerometer.SharedAccelerometer.Acceleration += OnAccelerated;
private void OnAccelerated (object sender, UIAccelerometerEventArgs e)
{
#if LINQ
myAccelerometer = new[]{e.Acceleration.X, e.Acceleration.Y, e.Acceleration.Z}
.Select((v, i) => v * FilteringFactor + myAccelerometer [i] * (1.0f - FilteringFactor))
.ToArray ();
#else
myAccelerometer [0] = e.Acceleration.X * FilteringFactor + myAccelerometer [0] * (1.0 - FilteringFactor);
myAccelerometer [1] = e.Acceleration.Y * FilteringFactor + myAccelerometer [1] * (1.0 - FilteringFactor);
myAccelerometer [2] = e.Acceleration.Z * FilteringFactor + myAccelerometer [2] * (1.0 - FilteringFactor);
#endif
... etc ...
}
]]></code>
</example>
</remarks>
<related type="sample" href="https://github.com/xamarin/ios-samples/tree/master/GLPaint-GameView/">GLPaintGameView</related>
<related type="sample" href="https://github.com/xamarin/ios-samples/tree/master/LowLevelGLPaint/">LowLevelGLPaint</related>
<related type="externalDocumentation" href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIAccelerometer_Class/index.html">Apple documentation for <c>UIAccelerometer</c></related>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public UIAccelerometer ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:UIKit.UIAccelerometer.#ctor" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
<AssemblyName>Xamarin.iOS</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>Foundation.Export("init")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)</AttributeName>
</Attribute>
</Attributes>
<Parameters />
<Docs>
<summary>Default constructor that initializes a new instance of this class with no parameters.</summary>
<remarks>
</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected UIAccelerometer (Foundation.NSObjectFlag t);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor(class Foundation.NSObjectFlag t) cil managed" />
<MemberSignature Language="DocId" Value="M:UIKit.UIAccelerometer.#ctor(Foundation.NSObjectFlag)" />
<MemberSignature Language="F#" Value="new UIKit.UIAccelerometer : Foundation.NSObjectFlag -> UIKit.UIAccelerometer" Usage="new UIKit.UIAccelerometer t" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
<AssemblyName>Xamarin.iOS</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="t" Type="Foundation.NSObjectFlag" />
</Parameters>
<Docs>
<param name="t">Unused sentinel value, pass NSObjectFlag.Empty.</param>
<summary>Constructor to call on derived classes to skip initialization and merely allocate the object.</summary>
<remarks>
<para>This constructor should be called by derived classes when they completely construct the object in managed code and merely want the runtime to allocate and initialize the NSObject. This is required to implement the two-step initialization process that Objective-C uses, the first step is to perform the object allocation, the second step is to initialize the object. When developers invoke the constructor that takes the NSObjectFlag.Empty they take advantage of a direct path that goes all the way up to NSObject to merely allocate the object's memory and bind the Objective-C and C# objects together. The actual initialization of the object is up to the developer.</para>
<para>This constructor is typically used by the binding generator to allocate the object, but prevent the actual initialization to take place. Once the allocation has taken place, the constructor has to initialize the object. With constructors generated by the binding generator this means that it manually invokes one of the "init" methods to initialize the object.</para>
<para>It is the developer's responsibility to completely initialize the object if they chain up using the NSObjectFlag.Empty path.</para>
<para>In general, if the developer's constructor invokes the NSObjectFlag.Empty base implementation, then it should be calling an Objective-C init method. If this is not the case, developers should instead chain to the proper constructor in their class. </para>
<para>The argument value is ignored and merely ensures that the only code that is executed is the construction phase is the basic NSObject allocation and runtime type registration. Typically the chaining would look like this:</para>
<example>
<code lang="csharp lang-csharp"><![CDATA[
//
// The NSObjectFlag merely allocates the object and registers the
// C# class with the Objective-C runtime if necessary, but no actual
// initXxx method is invoked, that is done later in the constructor
//
// This is taken from Xamarin.iOS's source code:
//
[Export ("initWithFrame:")]
public UIView (System.Drawing.RectangleF frame) : base (NSObjectFlag.Empty)
{
// Invoke the init method now.
var initWithFrame = new Selector ("initWithFrame:").Handle;
if (IsDirectBinding)
Handle = ObjCRuntime.Messaging.IntPtr_objc_msgSend_CGRect (this.Handle, initWithFrame, frame);
else
Handle = ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper_CGRect (this.SuperHandle, initWithFrame, frame);
}
]]></code>
</example>
</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected internal UIAccelerometer (IntPtr handle);" />
<MemberSignature Language="ILAsm" Value=".method familyorassemblyhidebysig specialname rtspecialname instance void .ctor(native int handle) cil managed" />
<MemberSignature Language="DocId" Value="M:UIKit.UIAccelerometer.#ctor(System.IntPtr)" />
<MemberSignature Language="F#" Value="new UIKit.UIAccelerometer : nativeint -> UIKit.UIAccelerometer" Usage="new UIKit.UIAccelerometer handle" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
<AssemblyName>Xamarin.iOS</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="handle" Type="System.IntPtr" />
</Parameters>
<Docs>
<param name="handle">Pointer (handle) to the unmanaged object.</param>
<summary>A constructor used when creating managed representations of unmanaged objects; Called by the runtime.</summary>
<remarks>
<para>This constructor is invoked by the runtime infrastructure (<see cref="M:ObjCRuntime.Runtime.GetNSObject(System.IntPtr)" />) to create a new managed representation for a pointer to an unmanaged Objective-C object. Developers should not invoke this method directly, instead they should call the GetNSObject method as it will prevent two instances of a managed object to point to the same native object.</para>
</remarks>
</Docs>
</Member>
<Member MemberName="Acceleration">
<MemberSignature Language="C#" Value="public event EventHandler<UIKit.UIAccelerometerEventArgs> Acceleration;" />
<MemberSignature Language="ILAsm" Value=".event class System.EventHandler`1<class UIKit.UIAccelerometerEventArgs> Acceleration" />
<MemberSignature Language="DocId" Value="E:UIKit.UIAccelerometer.Acceleration" />
<MemberSignature Language="F#" Value="member this.Acceleration : EventHandler<UIKit.UIAccelerometerEventArgs> " Usage="member this.Acceleration : System.EventHandler<UIKit.UIAccelerometerEventArgs> " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
<AssemblyName>Xamarin.iOS</AssemblyName>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.EventHandler<UIKit.UIAccelerometerEventArgs></ReturnType>
</ReturnValue>
<Docs>
<summary>This event is raised when a new acceleration event is ready.</summary>
<remarks>Use this event if you want to subscribe to notifications without having to create a UIAccelerometerDelegate class.</remarks>
</Docs>
</Member>
<Member MemberName="ClassHandle">
<MemberSignature Language="C#" Value="public override IntPtr ClassHandle { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance native int ClassHandle" />
<MemberSignature Language="DocId" Value="P:UIKit.UIAccelerometer.ClassHandle" />
<MemberSignature Language="F#" Value="member this.ClassHandle : nativeint" Usage="UIKit.UIAccelerometer.ClassHandle" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
<AssemblyName>Xamarin.iOS</AssemblyName>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.IntPtr</ReturnType>
</ReturnValue>
<Docs>
<summary>The handle for this class.</summary>
<value>The pointer to the Objective-C class.</value>
<remarks>Each Xamarin.iOS class mirrors an unmanaged Objective-C class. This value contains the pointer to the Objective-C class, it is similar to calling objc_getClass with the object name.</remarks>
</Docs>
</Member>
<Member MemberName="Delegate">
<MemberSignature Language="C#" Value="public UIKit.IUIAccelerometerDelegate Delegate { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class UIKit.IUIAccelerometerDelegate Delegate" />
<MemberSignature Language="DocId" Value="P:UIKit.UIAccelerometer.Delegate" />
<MemberSignature Language="F#" Value="member this.Delegate : UIKit.IUIAccelerometerDelegate with get, set" Usage="UIKit.UIAccelerometer.Delegate" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
<AssemblyName>Xamarin.iOS</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>UIKit.IUIAccelerometerDelegate</ReturnType>
</ReturnValue>
<Docs>
<summary>An instance of the UIKit.IUIAccelerometerDelegate model class which acts as the class delegate.</summary>
<value>The instance of the UIKit.IUIAccelerometerDelegate model class</value>
<remarks>
<para>The delegate instance assigned to this object will be used to handle events or provide data on demand to this class.</para>
<para>When setting the Delegate or WeakDelegate values events will be delivered to the specified instance instead of being delivered to the C#-style events</para>
<para>This is the strongly typed version of the object, developers should use the WeakDelegate property instead if they want to merely assign a class derived from NSObject that has been decorated with [Export] attributes.</para>
</remarks>
</Docs>
</Member>
<Member MemberName="Dispose">
<MemberSignature Language="C#" Value="protected override void Dispose (bool disposing);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void Dispose(bool disposing) cil managed" />
<MemberSignature Language="DocId" Value="M:UIKit.UIAccelerometer.Dispose(System.Boolean)" />
<MemberSignature Language="F#" Value="override this.Dispose : bool -> unit" Usage="uIAccelerometer.Dispose disposing" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
<AssemblyName>Xamarin.iOS</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="disposing" Type="System.Boolean" />
</Parameters>
<Docs>
<param name="disposing">
<para>If set to <see langword="true" />, the method is invoked directly and will dispose manage and unmanaged resources; If set to <see langword="false" /> the method is being called by the garbage collector finalizer and should only release unmanaged resources.</para>
</param>
<summary>Releases the resources used by the UIAccelerometer object.</summary>
<remarks>
<para>This Dispose method releases the resources used by the UIAccelerometer class.</para>
<para>This method is called by both the Dispose() method and the object finalizer (Finalize). When invoked by the Dispose method, the parameter disposing <paramref name="disposing" /> is set to <see langword="true" /> and any managed object references that this object holds are also disposed or released; when invoked by the object finalizer, on the finalizer thread the value is set to <see langword="false" />. </para>
<para>Calling the Dispose method when the application is finished using the UIAccelerometer ensures that all external resources used by this managed object are released as soon as possible. Once developers have invoked the Dispose method, the object is no longer useful and developers should no longer make any calls to it.</para>
<para> For more information on how to override this method and on the Dispose/IDisposable pattern, read the ``Implementing a Dispose Method'' document at https://msdn.microsoft.com/en-us/library/fs2xkftw.aspx</para>
</remarks>
</Docs>
</Member>
<Member MemberName="SharedAccelerometer">
<MemberSignature Language="C#" Value="public static UIKit.UIAccelerometer SharedAccelerometer { get; }" />
<MemberSignature Language="ILAsm" Value=".property class UIKit.UIAccelerometer SharedAccelerometer" />
<MemberSignature Language="DocId" Value="P:UIKit.UIAccelerometer.SharedAccelerometer" />
<MemberSignature Language="F#" Value="member this.SharedAccelerometer : UIKit.UIAccelerometer" Usage="UIKit.UIAccelerometer.SharedAccelerometer" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
<AssemblyName>Xamarin.iOS</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>get: Foundation.Export("sharedAccelerometer")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>UIKit.UIAccelerometer</ReturnType>
</ReturnValue>
<Docs>
<summary>The singleton instance of the UIAccelerometer.</summary>
<value>To be added.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="UpdateInterval">
<MemberSignature Language="C#" Value="public virtual double UpdateInterval { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance float64 UpdateInterval" />
<MemberSignature Language="DocId" Value="P:UIKit.UIAccelerometer.UpdateInterval" />
<MemberSignature Language="F#" Value="member this.UpdateInterval : double with get, set" Usage="UIKit.UIAccelerometer.UpdateInterval" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
<AssemblyName>Xamarin.iOS</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>get: Foundation.Export("updateInterval")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>set: Foundation.Export("setUpdateInterval:")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Double</ReturnType>
</ReturnValue>
<Docs>
<summary>The inerval, in seconds, between acceleration data events.|The interval, in seconds, between acceleration data events. Subject to hardwar</summary>
<value>To be added.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="WeakDelegate">
<MemberSignature Language="C#" Value="public virtual Foundation.NSObject WeakDelegate { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class Foundation.NSObject WeakDelegate" />
<MemberSignature Language="DocId" Value="P:UIKit.UIAccelerometer.WeakDelegate" />
<MemberSignature Language="F#" Value="member this.WeakDelegate : Foundation.NSObject with get, set" Usage="UIKit.UIAccelerometer.WeakDelegate" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
<AssemblyName>Xamarin.iOS</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>ObjCRuntime.BindingImpl(ObjCRuntime.BindingImplOptions.GeneratedCode | ObjCRuntime.BindingImplOptions.Optimizable)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>get: Foundation.Export("delegate", ObjCRuntime.ArgumentSemantic.UnsafeUnretained)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>set: Foundation.Export("setDelegate:", ObjCRuntime.ArgumentSemantic.UnsafeUnretained)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>Foundation.NSObject</ReturnType>
</ReturnValue>
<Docs>
<summary>An object that can respond to the delegate protocol for this type</summary>
<value>The instance that will respond to events and data requests.</value>
<remarks>
<para>The delegate instance assigned to this object will be used to handle events or provide data on demand to this class.</para>
<para>When setting the Delegate or WeakDelegate values events will be delivered to the specified instance instead of being delivered to the C#-style events</para>
<para> Methods must be decorated with the [Export ("selectorName")] attribute to respond to each method from the protocol. Alternatively use the Delegate method which is strongly typed and does not require the [Export] attributes on methods.</para>
</remarks>
</Docs>
</Member>
</Members>
</Type>