คลาสอิมเมจ GCK
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
คลาสที่แสดงรูปภาพที่อยู่ในเว็บเซิร์ฟเวอร์
ใช้สำหรับสิ่งต่างๆ เช่น ไอคอน GCKDevice และอาร์ตเวิร์ก GCKMediaMetadata
รับค่า NSObject, <NSCopying> และ <NSSecureCoding>
- (instancetype) initWithURL: |
|
(NSURL *) |
URL |
width: |
|
(NSInteger) |
width |
height: |
|
(NSInteger) |
height |
|
|
| |
สร้าง GCKImage ใหม่ด้วย URL และขนาดที่กำหนด
เครื่องมือเริ่มต้นที่กำหนด
- Parameters
-
URL | The URL of the image. |
width | The width of the image, in pixels. |
height | The height of the image, in pixels. |
- ข้อยกเว้น
-
NSInvalidArgumentException | หาก URL เป็น nil หรือว่างเปล่า หรือขนาดไม่ถูกต้อง |
เครื่องมือเริ่มต้นไม่พร้อมใช้งาน
ความกว้างของรูปภาพเป็นพิกเซล
ความสูงของรูปภาพเป็นพิกเซล
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[[["\u003cp\u003eThe \u003ccode\u003eGCKImage\u003c/code\u003e class represents an image located on a web server, used for elements like device icons and media metadata artwork.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods for initialization with a URL and dimensions, specifying the image's location and size.\u003c/p\u003e\n"],["\u003cp\u003eKey properties include \u003ccode\u003eURL\u003c/code\u003e, \u003ccode\u003ewidth\u003c/code\u003e, and \u003ccode\u003eheight\u003c/code\u003e, offering access to the image's web address and pixel dimensions.\u003c/p\u003e\n"],["\u003cp\u003eThe default initializer is unavailable; you must use the designated initializer with URL and dimensions.\u003c/p\u003e\n"]]],["The GCKImage class represents a web-hosted image, used for elements like device icons and media artwork. Key actions include initializing a GCKImage object with `initWithURL:width:height:`, providing the image's URL, width, and height in pixels. The default initializer `init` is unavailable. Properties include `URL` for the image's location, `width` for pixel width, and `height` for pixel height. Initialization with an invalid URL or dimensions will throw an exception.\n"],null,["# GCKImage Class\n\n[Instance Methods](#pub-methods) \\| [Properties](#properties) \nGCKImage Class Reference \n\nOverview\n--------\n\nA class that represents an image that is located on a web server.\n\nUsed for such things as [GCKDevice](/cast/docs/reference/ios/interface_g_c_k_device \"An object representing a receiver device. \") icons and [GCKMediaMetadata](/cast/docs/reference/ios/interface_g_c_k_media_metadata \"A container for media metadata. \") artwork.\n\nInherits NSObject, \\\u003cNSCopying\\\u003e, and \\\u003cNSSecureCoding\\\u003e.\n\n|----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Instance Method Summary ----------------------- ||\n| (instancetype) | - [initWithURL:width:height:](/cast/docs/reference/ios/interface_g_c_k_image#a20f5e64c10e78d2672b1dfa20ff0b76f) |\n| | Constructs a new [GCKImage](/cast/docs/reference/ios/interface_g_c_k_image \"A class that represents an image that is located on a web server. \") with the given URL and dimensions. [More...](#a20f5e64c10e78d2672b1dfa20ff0b76f) |\n| ||\n| (instancetype) | - [init](/cast/docs/reference/ios/interface_g_c_k_image#af03b299c34947ba97027cf2603f95c4b) |\n| | Default initializer is not available. [More...](#af03b299c34947ba97027cf2603f95c4b) |\n| ||\n\n|-----------|--------------------------------------------------------------------------------------------|\n| Property Summary ---------------- ||\n| NSURL \\* | [URL](/cast/docs/reference/ios/interface_g_c_k_image#a1a70791ad8a7ce7920043c12196b88e5) |\n| | The image URL. [More...](#a1a70791ad8a7ce7920043c12196b88e5) |\n| ||\n| NSInteger | [width](/cast/docs/reference/ios/interface_g_c_k_image#a7ec3d003921bed52ba5ad837e0d5a3d8) |\n| | The image width, in pixels. [More...](#a7ec3d003921bed52ba5ad837e0d5a3d8) |\n| ||\n| NSInteger | [height](/cast/docs/reference/ios/interface_g_c_k_image#a9ca09c90d7659f36990e95c257764c66) |\n| | The image height, in pixels. [More...](#a9ca09c90d7659f36990e95c257764c66) |\n| ||\n\nMethod Detail\n-------------\n\n|-------------------------------|---|-------------|----------|\n| - (instancetype) initWithURL: | | (NSURL \\*) | *URL* |\n| width: | | (NSInteger) | *width* |\n| height: | | (NSInteger) | *height* |\n| | | | |\n\nConstructs a new [GCKImage](/cast/docs/reference/ios/interface_g_c_k_image \"A class that represents an image that is located on a web server. \") with the given URL and dimensions.\n\nDesignated initializer.\n\nParameters\n:\n\n |--------|-------------------------------------|\n | URL | The URL of the image. |\n | width | The width of the image, in pixels. |\n | height | The height of the image, in pixels. |\n\n\nExceptions\n:\n\n |----------------------------|--------------------------------------------------------------|\n | NSInvalidArgumentException | if the URL is `nil` or empty, or the dimensions are invalid. |\n\n\n|-----------------------|---|---|---|\n| - (instancetype) init | | | |\n\nDefault initializer is not available.\n\nProperty Detail\n---------------\n\n|-----------------------------------------|---------------------|\n| |-----------------| | - (NSURL\\*) URL | | readnonatomicstrong |\n\nThe image URL. \n\n|-------------------------------------------------|---------------------|\n| |---------------------| | - (NSInteger) width | | readnonatomicassign |\n\nThe image width, in pixels. \n\n|---------------------------------------------------|---------------------|\n| |----------------------| | - (NSInteger) height | | readnonatomicassign |\n\nThe image height, in pixels."]]