【发布时间】:2018-01-05 15:22:52
【问题描述】:
我正在尝试打印原始指针指向的指针的内容,但是当我打印或 NSLog 时,我得到的指针值比指针指向的内存内容要多。如何打印指针指向的内存内容?以下是我的代码:
let buffer = unsafeBitCast(baseAddress, to: UnsafeMutablePointer<UInt32>.self)
for row in 0..<bufferHeight
{
var pixel = buffer + row * bytesPerRow
for _ in 0..<bufferWidth {
// NSLog("Pixel \(pixel)")
print(pixel)
pixel = pixel + kBytesPerPixel
}
}
【问题讨论】:
标签: ios swift unsafemutablepointer